Bug 66610 - when invoke method XSSFWorkbook workbook = new XSSFWorkbook(File file) ,java.lang.OutOfMemoryError: Java heap space occurred
Summary: when invoke method XSSFWorkbook workbook = new XSSFWorkbook(File file) ,java....
Status: RESOLVED INFORMATIONPROVIDED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 5.2.3-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-22 02:09 UTC by younger
Modified: 2023-05-22 08:54 UTC (History)
0 users



Attachments
The excel file mentioned above (501.59 KB, application/x-zip-compressed)
2023-05-22 02:12 UTC, younger
Details

Note You need to log in before you can comment on or make changes to this bug.
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