Java Read Excel xlsx file – Part 1

Excel xlsx file can be read with plain java, because xlsx files are compressed xml files in one file, like a ZIP file.
Since java has an API to work with ZIP files we can treat a xlsx file like a zip file.

In this part I’ll extract the sheet files and additionally the file with all strings (sharedstrings).
One thing you should know is that this file with strings has only unique strings in it and these are mapped to sheets with integers. So all strings in xlsx file are saved only once, no duplicates.

Refer to part 2 to see how the value in a cell can be read from sheet and sharedstrings.

Get Sheet Streams

Get Strings as List

Usage

Go to Part 2


3 thoughts on “Java Read Excel xlsx file – Part 1

  1. You can look at JSpreadsheet from Independentsoft, a component for Java and Android that makes it easy to create and read Excel .xlsx files.

    • Thx but the point is not to use any extra libraries and I find this way to be relatively easy

  2. Good post. I learn something totally new and challenging on websites I stumbleupon on a daily
    basis. It will always be useful to read through articles from other authors and practice something from their web sites.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*
Website