Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Reading from Microsoft Excel in Java

Reply
Thread Tools

Reading from Microsoft Excel in Java

 
 
Brian J. Sayatovic
Guest
Posts: n/a
 
      06-27-2003
I have the need to read data from an Excel file. The data is really
simply homogenuous records, along with a header row that describes the
records in the rows beneath it. Naturally, I investigated my options,
but none have proven to do quite what I want yet. Here's the
requirements I have:

- Can be restricted to Windows only
- Shouldn't involve me writing JNI directly
- Shouldn't involve doing any pre-processing to the spreadsheet
- Must be able to read literal values from cells
- Must be able to read calculated values from cells.

Here's the solutions I've been investigating:

JCom (http://www.hcn.zaq.ne.jp/no-ji/jcom/index_eng.htm)
====
- Javadocs in Japanese
- Doesn't expose full Excel functionality (i.e. Range.Offset)

JACOB (http://danadler.com/jacob/)
=====
- Low-level COM, but I used Jacobgen
(http://www.bigatti.it/projects/jacobgen/) to overcome this
- Generated code resulted in C0000005 access violations

POI-HSSF (http://jakarta.apache.org/poi/hssf/index.html)
========
- Doesn't support calculated values (you get the literal formula)

This is a simple little project, and I don't want ot invest in any
expensive commercial ware. The next thing I'm going to investigate is
the ODBC driver for Excel accessed via the JDBC-ODBC bridge, but I
won't be able to set up a DSN for each spreadsheet I want to read.

Anyone else have any experience with this?
 
Reply With Quote
 
 
 
 
Shripathi Kamath
Guest
Posts: n/a
 
      06-27-2003

"Brian J. Sayatovic" <> wrote in message
news: om...
> I have the need to read data from an Excel file. The data is really
> simply homogenuous records, along with a header row that describes the
> records in the rows beneath it. Naturally, I investigated my options,
> but none have proven to do quite what I want yet. Here's the
> requirements I have:
>
> - Can be restricted to Windows only
> - Shouldn't involve me writing JNI directly
> - Shouldn't involve doing any pre-processing to the spreadsheet
> - Must be able to read literal values from cells
> - Must be able to read calculated values from cells.
>



If you have to just read from an Excel file, you can simply read the text in
using FileInputStream and family, and do with it as you please. You may
choose to save the file in a .csv format.

I suspect that you need to read from Excel itself. Depending upon the
version of MS Excel, you can do using automation, and JActiveX. With your
restrictions, you would likely be restricted to using the MS VM. If you
have a Visual J++ v 6.0, you should be able to do this.


HTH,


--
Shripathi Kamath
NETAPHOR SOFTWARE INC.
http://www.netaphor.com


<snip>


 
Reply With Quote
 
 
 
 
NoName NoName
Guest
Posts: n/a
 
      07-05-2003
Go to Apache POI site and follow HSSF links.
http://jakarta.apache.org/poi/index.html
http://jakarta.apache.org/poi/hssf/index.html

Copypaste from site which should answer your question: "If you're merely
reading spreadsheet data, then use the eventmodel api in the
org.apache.poi.hssf.eventmodel package"

> I have the need to read data from an Excel file. The data is really
> simply homogenuous records, along with a header row that describes the

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola MCSE 4 11-15-2006 02:40 AM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola Microsoft Certification 3 11-14-2006 05:18 PM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola MCSD 3 11-14-2006 05:18 PM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd realexxams@yahoo.com Microsoft Certification 0 05-10-2006 02:35 PM
microsoft.public.dotnet.faqs,microsoft.public.dotnet.framework,microsoft.public.dotnet.framework.windowsforms,microsoft.public.dotnet.general,microsoft.public.dotnet.languages.vb Charles A. Lackman ASP .Net 1 12-08-2004 07:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57