Free Support Forum - aspose.com

Aspose Cells - Generating EXCEL with CSV file

I am trying to import a CSV file into an existing excel file. I do it like following

Worksheet exportWorksheet = templateWorkSheets.get(B_Reporttype.TEMPLATE_WORKSHEET);
exportWorksheet.getCells().importCSV(report.getDynamicReportDataFilePath().toString(), loadOptions, 0, 0);

When my CSV becomes larger (in my case 350 MB), I get an out of memory exception.

  • What is the recommended way to import large text files to excel
  • Is there a way to check whether we have enough memory to support the CSV file

@sgurusinghe,
Thank you for your query.

You may try using MemorySetting.MEMORY_PREFERENCE while loading large files as mentioned in the following article:

Optimizing Memory Usage while Working with Big Files having Large Datasets

You may also try to load the same CSV file into MS Excel and observe the behaviour. If it creates rows and columns more than the Excel file limit, it will raise an error in MS Excel and raise exception while using Aspose.cells as well because Aspose.Cells mimics the behaviour of MS Excel. If your issue is not resolved, please share the sample CSV file after compressing it and uploading it to some public file sharing server. Share the link here for our reference as we need to reproduce the issue here for providing further assistance.