What is the best API to read large excel files using Java?

I need to read large Excel worksheets using Java. Excel sheet can be .xls or .xlsx. A sheet can have thousands of rows. I need to read all the rows and insert this row into the database.

So basically read from Excel and write to the database.

The API I'm looking at is the POI and JExcel APIs (after searching and reading some other related articles in SO).

But I'm still not sure about what is the most suitable way to read very large Excel sheets.

I no longer want to have memory problems.

Change 1:

Also, from what I was looking so far, it seems that JExcel does not support .xlsx formats.

Please offer.

+4
source share
3 answers

We read Excel files of this size with the Apache POI without any problems.

+3
source

If you only want to read files, then the performance should be no problem with the Apache POI, since streaming APIs are used for reading (I think SAX vs. DOM).
See http://poi.apache.org/spreadsheet/index.html

Writing Excel files using POI will be another scenario. But at least there is a beta extension for .xlsx files to provide more efficient write operations with Apache POI ( SXSSF ).

+3
source

Try jExcel

See the FAQ here .

I prefer its Apache POI because of performance and usability.

Reading .xlsx is a limitation of the jExcel library.

0
source

Source: https://habr.com/ru/post/1396348/


All Articles