简体   繁体   中英

Is there any limitation on size of excel file that Apache POI can handle?

I am using Apache POI to create a excel sheet and write data into it through java program and reading the same file in different java program. I heard that Apache POI can handle maximum size of 1 MB? Am I right?

If it is, then what is the option for this?

The limits of Excel file formats are defined in class SpreadsheetVersion , as long as you have enough main-memory, you should be able to handle files up to these limits. For huge files using the default POI classes you will need a big amount of memory and that is likely where the "maximum file size" myth comes from.

There are ways to overcome the main-memory limitations if needed:

For writing very huge files, there is SXSSFWorkbook which allows to do a streaming write of data out to files (with certain limitations on what you can do as only parts of the file are held in memory).

For reading very huge files, take a look at the sample XLSX2CSV which shows how you can read a file in streaming fashion (again with some limitations on what information you can read out of the file, but there are ways to get at most of it if necessary)

Apache POI可以处理多个MB文件,可以正确使用您的内存。未提及的Apache poi限制列表

[https://poi.apache.org/spreadsheet/limitations.html][1]

I think there is a limitation for input file size, because I have a problem about reading a xlsx file which size is 200+MB, when I read it with apache poi, then the exception like below

Exception in thread "main" java.io.IOException: MaxLength (100000000) reached - stream seems to be invalid. and when I search the message from source code, it can not be changed, caz it's hard code, this is what I found

source code segment which confuse me

searching from the class that from above pic, there is no way to change the MAX_ENTRY_SIZE .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM