Reading from Microsoft Excel in Java

Discussion in 'Java' started by Brian J. Sayatovic, Jun 27, 2003.

  1. 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?
    Brian J. Sayatovic, Jun 27, 2003
    #1
    1. Advertising

  2. "Brian J. Sayatovic" <> wrote in message
    news:...
    > 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>
    Shripathi Kamath, Jun 27, 2003
    #2
    1. Advertising

  3. 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
    NoName NoName, Jul 5, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman
    Replies:
    1
    Views:
    1,321
    smith
    Dec 8, 2004
  2. SpamProof
    Replies:
    0
    Views:
    528
    SpamProof
    Oct 21, 2003
  3. =?Utf-8?B?U3JpZGhhcg==?=

    using Microsoft Excel image for Export to Excel button

    =?Utf-8?B?U3JpZGhhcg==?=, Dec 9, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    3,076
    =?Utf-8?B?U3JpZGhhcg==?=
    Dec 9, 2005
  4. pps!
    Replies:
    0
    Views:
    1,015
  5. fniles
    Replies:
    0
    Views:
    261
    fniles
    Apr 26, 2009
Loading...

Share This Page