Reading .xls in java using Apache POI

  • Context: Java 
  • Thread starter Thread starter nkk2008
  • Start date Start date
  • Tags Tags
    apache Java Reading
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 4K views
nkk2008
Messages
32
Reaction score
0
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.

Thanks
Nkk
 
Physics news on Phys.org
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.