Read a CSV file with more than 1,048,576 rows

GemBox.Spreadsheet's content model has the same limitations as the XLSX file format (1,048,576 rows and 16,384 columns per sheet), the file format closest to the GemBox.Spreadsheet model and Microsoft Excel.

Because of these limitations, we cannot load a CSV file with more than 1,048,576 rows into a single ExcelWorksheet. However, a workaround exists. We can load a CSV file into multiple ExcelWorksheets, so that when the limitation of 1,048,576 rows is passed, the following rows are loaded into separate ExcelWorksheet.

For this workaround we can use the ExcelFile.Load(TextReader, CsvLoadOptions) method and provide a custom TextReader to read the CSV sheets.The code for the custom TextReader (CsvTextReader) and an example of its usage are provided below.