The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
May 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Excel to JDBC

Posted by Yash on October 29, 2001 at 5:53 AM

ResultSet.getMetaData() does work with excel too :-)
Try visiting this link and see if it can help you.
http://www.planet-source-code.com/xq/ASP/txtCodeId.2180/lngWId.2/qx/vb/scripts/ShowCode.htm

> >
> > Is there any way that I can access a cell value in a Excel sheet through java.
> > If yes just tell me how can we do that.

> You can access an Excel sheet in java easily by using a database acess:

> you have to create a jdbc connection that uses the JDBC:ODBC driver (see the JDBC tutorial from sun, great explanations ...) an point to the url of your spreadsheet and use sql queries such as (SELECT * FROM "spreadsheet1$") assuming spredsheet1 is the first spreadsheet in your workbook (notice the additional '$' added I don't know why)
> It's "that" easy ...

> Now I have another question ... all this above is easy as long as you know how the workbook is formed (eg: you know your spreadsheets names) but how can you do if you don't know the workbook and you get it as a parameter.
> You have to find a way to get the "TREE" structure from the workbook.
> I know that there is a ResultSet.getMetaData() method working great with Access or Oracle, but I can't get it work with Excell.

> Hope this helped you ... and hope you will help me :)

> Lionel






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us