Home » excel » java – How to read xlsx file in an android application?

java – How to read xlsx file in an android application?

Posted by: admin April 23, 2020 Leave a comment


I know there’s many same questions on stackoverflow, but it seems that I can’t see any possible solution for reading the content of xlsx.

What I have try:

I have try to put the whole Apache POI library to an android application and try to read the xlsx file.
However, the problem is that the Apache POI library is too heavy to put into an android application. An error message shows that the Dalvik VM cannot execute an app with more than 65536 methods.

It there any way to read the content of the xlsx file (could be the content only, other formatting such as color/width of the cell is not important) in an android app?
Or it there any one tried to trim down the apache poi library so that Dalvik VM can execute it?
As I saw that QuickOffice from Google Play are also using Apache POI, but I really don’t know how to put the POI into an app.
Thanks so much.

How to&Answers:

Apache POI 3.5 have added support to all the OOXML (docx, xlsx, etc.)

See the XSSF sub project


Just committed XSSF Android usage demo on github:


The core idea is just to remove from poi-ooxml and poi-ooxml-schemas all files which are seems to be not necessary to read XLSX. For example xslf and xwpf from poi-ooxml, schemas presentationml and wordrpocessingml from poi-ooxml-schemas and other stuff…

After that, build your project and try to read XLSX, read log after that fails and see which dependency caused this fail, copy missed file from original poi-ooxml-schemas jar. Do it again and again unless it is working.

UPD: no more need in –core-library option!

Demo mentioned above already contains reduced poi-ooxml and poi-ooxml-schemas.