CSV file with 5 million rows using aspose library

HI Team
I’m from Deloitte and we have a license for aspose totals and use extensively for excel interaction.
I have a requirement to generate a text/CSV file which could have 2 5o 5 million rows. As excel couldn’t fit this number, we want to use proper text file csv.
Can you please let me know if aspose has libraries which can help generate txt/csv files with 2 to 5 million rows.

Thanks
Sunil Soma

@susoma,

Aspose.Cells supports to create or render CSV files, see the document for your reference. Please note, generally, MS Excel can have up to 1,048,576 rows and 16,384 columns in a single worksheet. Aspose.Cells follows MS Excel standards and specifications when generating CSV files, so you cannot have more than 1,048,576 records in the file. However, if you think MS Excel can have such a CSV file with 2 to 5 million rows in CSV file, let us know details on how to generate such a file in MS Excel manually, we will check it on how to do it via Aspose.Cells APIs.

@susoma,

Because the limit of file format for spreadsheet, we cannot support to create a worksheet with so many rows data directly. However, creating one csv file with so large data set is still possible with Aspose.Cells. You may split your data(5 million rows) into multiple sheets or multiple workbooks and then save them into the same file(stream).

Splitting your data into multiple worksheets in a single workbook is more convenient. You can just save the workbook as csv with TxtSaveOptions.ExportAllSheets = true.

However, creating a workbook with so large data set is sure to need lots of memory. Another way is to split the data into multiple workbooks and then save those workbooks into the resultant csv file(stream):

            FileStream fs = new FileStream("res.csv", FileMode.CreateNew);
            Workbook wb = ....
            ...
            wb.Save(fs, SaveFormat.Csv);
            wb = ....
            ...
            wb.Save(fs, SaveFormat.Csv);
            fs.Close();