This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Java in General and the fly likes writing excel through java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "writing excel through java" Watch "writing excel through java" New topic

writing excel through java

supriya lal

Joined: Sep 11, 2012
Posts: 15
hello... I am trying to read an excel file hello and add new cells in the end an then add data to it and save it.. but my following programme is not producing any output.please help
Mark Beardsley
Ranch Hand

Joined: Jun 07, 2013
Posts: 32
My first observation is that you are using the wrong set of classes to handle the workbook. Excel workbooks come in two different formats; the older binary file format (.xls) and the newer OOXML format (.xlsx). From the code you posted, you would appear to be working with one of the newer format files - from the file extension .xlsx - and to do this with POI, you need to use the XSSF classes not the HSSF ones. Better still would be to use the classes in the unifying ss usermodel stream.

There are numerous examples on the POI website,
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
This is a bad idea:

catch(Exception e){}

How will you what problems there are?
supriya lal

Joined: Sep 11, 2012
Posts: 15
Thankyou Mark it worked
supriya lal

Joined: Sep 11, 2012
Posts: 15
yes I never use catch(Exception e)... It was for the example..thankyou
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: writing excel through java
It's not a secret anymore!