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

This is a back text to this post at Mets BCom

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

  1. Stuart

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

    Reply
    1. metin Post author

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

      Reply

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">