Hi,
We are using aspose to merge CSV file to XLS file in java code.
When the size of the CSV is large it is throwing OutOfMemoryError in aspose code.
This is the code snippet I tried.
try
{
Workbook wb=new Workbook(“rams3base.xlsx”);
Cells cells =wb.getWorksheets().get(“sheet1”).getCells();
final TxtLoadOptions options = new TxtLoadOptions();
cells.importCSV(“3327d2fc0a07009a3cf130a6f063ab28_Sheet1.csv”, options, 0, 1);
wb.save(“rams3base.xlsx”);
}
catch(Throwable e)
{
e.printStackTrace();
}
Not able to attach the CSV file that is causing the issue.
But the size of the CSV is more than 600 MB.
It is throwing the following exception from aspose.
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Unknown Source)
at java.lang.String.(Unknown Source)
at java.lang.StringBuilder.toString(Unknown Source)
at com.aspose.cells.b.a.d.n.f(Unknown Source)
at com.aspose.cells.bec.a(Unknown Source)
at com.aspose.cells.bec.b(Unknown Source)
at com.aspose.cells.bec.a(Unknown Source)
at com.aspose.cells.bec.a(Unknown Source)
at com.aspose.cells.Cells.importCSV(Unknown Source)
at com.rams.Test.main(Test.java:170)
Please suggest if there is any other way of merging large CSV s into Excel with out consuming lot of memory.
This is very critical for us.
Please suggest how to use importCSV with large CSV files.