Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Excel & Java

 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any java code that reads a excel ..
I mean a java code that treats excel as a back end ..

Srini
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks i wrote .. it's a normal Jdbc code for Excel driver
 
Arnold Reuser
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you already familiar with the POI project?
http://jakarta.apache.org/poi/

An excerpt from their site :

The POI project consists of APIs for manipulating various file formats based upon Microsoft's OLE 2 Compound Document format using pure Java. In short, you can read and write MS Excel files using Java. Soon, you'll be able to read and write Word files using Java. POI is your Java Excel solution as well as your Java Word solution. However, we have a complete API for porting other OLE 2 Compound Document formats and welcome others to participate.
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh !! it's very nice ...
i'll have a look at it

Thanks yaar...
Srini
 
Terry Mullett
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've used POI on the job and it works great. It does (or at least did when I last used it) model the Excel format fairly directly, which requires that the developer needs to have some cognizance of how Excel stores data. Excel has a pretty crappy format. But once you understand it, POI's not hard to use.

Another option that works well if you're using spreadsheets as input is to have your spreadsheets saved as XML and then use XPath (or DOM or what-not) to navigate to the pieces you want to work with. That's pretty slick if you can hand out an input template with named sheets, named ranges and sheet/workbook protection, because there will be XML elements that help you identify cells semantically. As far as I know, saving as XML can only be done with Excel XP/2003.

Regards,
Terry
SCEA,SCWCD,SCBCD,SCJP
 
Arnold Reuser
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't know that the combination of XML and XPath was possible for spreadsheets. Is this solution straightforward or do you have to have a lot of experience with MS XML, maybe there are some strange side effects, to generate spreadsheets like that?
Can you also import the xml structure as an excel spreadsheet?
[ October 03, 2004: Message edited by: Arnold Reuser ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic