Skip to content

System.IO.IOException: Stream was too long. #793

Description

@rferraton

Excel Type

  • XLSX
  • XLSM
  • CSV
  • OTHER

Description

Problem when trying to insert many data 900k rows x 72 columns

Receive the following message :

System.IO.IOException: Stream was too long.
   at System.IO.MemoryStream.Write(ReadOnlySpan`1 buffer)
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.IO.StreamWriter.Write(String value)
   at MiniExcelLibs.OpenXml.ExcelOpenXmlSheetWriter.WriteCell(MiniExcelStreamWriter writer, Int32 rowIndex, Int32 cellIndex, Object value, ExcelColumnInfo columnInfo, ExcelWidthCollection widthCollection)
   at MiniExcelLibs.OpenXml.ExcelOpenXmlSheetWriter.WriteValues(MiniExcelStreamWriter writer, Object values)
   at MiniExcelLibs.OpenXml.ExcelOpenXmlSheetWriter.CreateSheetXml(Object values, String sheetPath)
   at MiniExcelLibs.OpenXml.ExcelOpenXmlSheetWriter.Insert(Boolean overwriteSheet)
   at MiniExcelLibs.MiniExcel.Insert(String path, Object value, String sheetName, ExcelType excelType, IConfiguration configuration, Boolean printHeader, Boolean overwriteSheet)
   at FastBCP.Transfer.DataToExcel(ParsingArguments p, TypeCode[] typeCodes, String connectionType, String _connectionString, String presql, String inputsql, String filePath, String fileName, Encoding encode, NumberFormatInfo nfi, String dateformat, Boolean useQuoteIdentifier, String delimiter, String boolformat, String headerline)

Would it be possible to use a stream buffer (let's say 10MB) ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions