Free Support Forum -

Merging csv files to excel


i have a question regarding the merging the csv 's to excel.

i used importcsv to import large csv file (120mb) to excel got heap memory error.

i thought of splitting the large csv to smaller csv 's and merge them one by one to excel file . what is best way of doing this using aspose.

i want to split the each csv file using the separator and then merge the data to excel not just importing csv to excel.

can you please suggest me the best way with example?


importTwoDimensionArray() is also throwing the heap memory exception after 7000 records while creating instance to workbook.


this is a critical issue from our side can any one please update on this soon.

i tried by increasing the memory to 2048 also…but no luck.



Well, as I told you if your file has millions of records, so surely, it would demand lots of memory to be used for opening, and re-saving the file. I am afraid, we have no better solution for this to cope with it at the moment, you need to have sufficient amount of RAM allocated for the large file(s) to be processed.

For example, you need to extend the JVM memory when running the JAVA program. For example, I used your attached CSV file (in your other thread), now I don’t find the memory issue any longer when using the command line:

F:\Files>java -Xms1024m -Xmx1024m MyTest


Here is my sample JAVA program:

Sample code:

Workbook workbook = new Workbook(“31d54ba00a03000e00eb3071fea764d8_Sheet1.csv”);

Moreover, we have LightCells APIs / feature that uses the lessor amount of memory to certain extent, but again it does not support reading files directly at the moment, it only supports writing bigger files from the scratch. By the way, as you told you may split your big csv file into smaller files, I think, you may read your csv files into an Array by using your own JAVA code, now you may paste the values by using cell.putValue() method (of Aspose.Cells for Java APIs) cell by cell in rows in LightCells architecture. You may import one csv file into one sheet at a time. Finally you may save the file to XLSX file format.

Thank you.