Bug 66610

Summary: when invoke method XSSFWorkbook workbook = new XSSFWorkbook(File file) ,java.lang.OutOfMemoryError: Java heap space occurred
Product: POI Reporter: younger <liuyang19870120>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED INFORMATIONPROVIDED    
Severity: normal    
Priority: P2    
Version: 5.2.3-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: The excel file mentioned above

Description younger 2023-05-22 02:09:08 UTC
The file size is about 5M(see the attachment below),but when invoke the method: XSSFWorkbook workbook = new XSSFWorkbook(File file) ,
java.lang.OutOfMemoryError: Java heap space occurred.
Comment 1 younger 2023-05-22 02:12:45 UTC
Created attachment 38564 [details]
The excel file mentioned above
Comment 2 PJ Fanning 2023-05-22 08:54:53 UTC
Reading a large xlsx file requires a lot of memory. Try increasing your Xmx size.

There is also support for streaming the Excel data - see https://poi.apache.org/components/spreadsheet/how-to.html and the 'XSSF and SAX (Event API)' section in it.

There are external libs for stream reading that might be easier to use:
* https://github.com/pjfanning/excel-streaming-reader
* https://github.com/dhatim/fastexcel