2

I am creating an excel sheet of more than 100k rows. I have used SXSSF, since I am handling huge data

 SXSSFWorkbook workbook = new SXSSFWorkbook( 10000 );

keeping 10 000 rows in cache.

But I am getting

java.lang.IllegalArgumentException: Attempting to write a row[23237] in the range [0,23272] that is already written to disk. at org.apache.poi.xssf.streaming.SXSSFSheet.createRow(SXSSFSheet.java:111)

I have tried increasing the cache rows to 50 000:

SXSSFWorkbook workbook = new SXSSFWorkbook( 50000 );

But still getting same exception.

In addition to that I have tried the other way of flushing the rows manually like,

SXSSFWorkbook workbook = new SXSSFWorkbook( -1 ); // which will store unlimeted rows in cache
sheet.flushRows();

even this was causing the similar exception!

java.lang.IllegalArgumentException: Attempting to write a row[22708] in the range [0,22719] that is already written to disk.

Not sure what is wrong with 23237 th row where this exception occurs! Despite giving the number of rows of more than 50000 in the cache.

James Z
  • 12,209
  • 10
  • 24
  • 44
user2699067
  • 33
  • 2
  • 8

0 Answers0