Java Reading .xls in java using Apache POI

AI Thread Summary
To read .xls files in Java using Apache POI, first, download the binaries from the Apache POI website and extract them using a zip or tar program. After installation, you can import the necessary classes in your Java program, specifically focusing on the HSSF package for handling .xls files. When packaging your program for distribution, ensure to include the required Apache POI jars alongside your own code, as they will not be automatically included. Check the licensing requirements for redistribution to comply with legal obligations. Understanding how to create executable jars may also be beneficial for easier deployment on other machines.
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
 
Technology 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.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top