We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Exporting maximum records to excel

I have tried the following code with 20,000 lines, but i got the exception : Java heap space.
I there any way to overcome this…???

Workbook workbook = new Workbook();
Worksheets worksheets = workbook.getWorksheets();
Worksheet sheet = worksheets.getSheet(0);
sheet.setName(“Export Test”);
Cells cells = sheet.getCells();
int k=0; int j=0;
Cell cell;
for(int i=0;i<20000;i++){
cell = cells.getCell(i, j);

got exception after executing the code

Exception in thread “main” java.lang.OutOfMemoryError: Java heap space
at com.aspose.cells.Row.getCell(Unknown Source)
at com.aspose.cells.Cells.getCell(Unknown Source)
at ReadWriteExcel.(ReadWriteExcel.java:109)
at ReadWriteExcel.main(ReadWriteExcel.java:205)


Well, I tried your code, it works fine on my “Core 2 Duo” processor (2.00Ghz) with 2GB RAM. The generated file is about 12GB in size. I used the attached latest version, please try it.

Furthermore, while rendering larger reports, you should have sufficient memory assigned/allotted to JVM to process the reports. Kindly make sure that you have provided and extended the JVM memory appropriately to process the file if you got lower configuration pc/system.

Following is the command line you may use on the Windows XP command prompt to extend the JVM memory accordingly:


java -Xms1024m -Xmx1024m MyTestProgram

Thank you.