monitorjbl / excel-streaming-reader

An easy-to-use implementation of a streaming Excel reader using Apache POI
Apache License 2.0
943 stars 342 forks source link

java.lang.NullPointerException at com.monitorjbl.xlsx.impl.StreamingSheetReader.setFormatString #222

Open yuzhangyi opened 3 years ago

yuzhangyi commented 3 years ago

Hi, @monitorjbl, when I try to read excel file with millions of rows, it will meet up NullPointerException.

StreamingReader.builder().rowCacheSize(1000).bufferSize(100 1024 1024).open(inputStreamProvider)

The error is happened in "SteamingWorkbookReader.java" and line 273, the stylesTable is null. if(cellStyleString != null) { style = stylesTable.getStyleAt(Integer.parseInt(cellStyleString)); } else if(stylesTable.getNumCellStyles() > 0) { style = stylesTable.getStyleAt(0); }

It has two worksheets in my excel file, one "sheet1" has 183601 rows with 43 columns, the other "sheet2" has 1 row with 5 columns. After I delete data from "sheet2" and read data from "sheet1" again, it can work well.

Could you help have a look?

Thanks!

JSRAJPUT commented 3 years ago

I have only one worksheet and facing same issue. stylesTable is null in "SteamingWorkbookReader.java" at line 273 Error : java.lang.NullPointerException at com.monitorjbl.xlsx.impl.StreamingSheetReader.setFormatString(StreamingSheetReader.java:273).