Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Reading .xls in java using Apache POI

  1. Sep 11, 2010 #1
    I have been given the task to write a program that does some basic math and numerical integration on numbers. Those numbers are stored in a .xls file. I have looked online and have seen the Apache POI and whatnot, but I have some serious problems stemming from my total lack of knowledge:

    How would I install the binaries at http://poi.apache.org/download.html ? I am running Ubuntu 10.04.

    After installation, do I just use import and package to use them in the program? What exactly do I say? I only need HSSF. I use Eclipse, but may dabble in Netbeans, if that makes any difference.

    Once I actually implement them, what if I need to package my program and use it on multiple computers? Would that be easy? I have no idea how to package a program for use (I know I have to make a .jar, but that is it), but that is a bridge to cross later. What I need to know is if it will be easy to use this API on other machines. Will the parts I import be packaged in the jar? Will the other computer (not the one used to develop the program) need to install the Apache POI?

    As you can see, I am totally new at this. I am good at actually coding and the logical part of the process, but I am totally lost when it comes to actually doing anything with my code other than running it within my IDE. Any help would be appreciated.

  2. jcsd
  3. Sep 11, 2010 #2
    Without actually LOOKING at the downloads I would expect that the files contain java jars that have the classes described in the javadoc section of the pages you linked. You will need a gzip (or probably just zip) program to unzip and a tar program to install them someplace. There might even be instructions included if you poke deep enough.

    As to using them, I would hope that there is some high level user doc, or at least example programs, included or on that site someplace. It looks like you might be interested in the "hssf" -- Horrible SpreadSheet Format -- package.

    When you distribute your program you will need to include the relevant packages and jars from the POI project along with your own code and classes. You will have to look at the licensing requirements to see what you need to do to redistribute. It is possible to make "executable jars" that double-click-run on Windoze, but I forget the full process.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook