Results 1 to 6 of 6

Thread: Excel

  1. #1
    Join Date
    Jun 2008
    Posts
    54
    Rep Power
    0

    Default Excel

    Hello together
    it's me again, at the moment i have to write a code which is reading in numbers from an excel sheet. I found already an example how to do it, but it is not completely working it is saying that i hace to write

    Workbook wokrbook = Workbook.getWorkbook(new File("FileName.xls"))

    etc.

    but my java is always telling me, that i have to create a Workbook class or sth similar so i was wondering if some might tell me, what i actually have to do and what it means...

    thanks for ur help already

    little_polarbear

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,449
    Rep Power
    25

    Default

    Very vague question. Not sure what you are asking.
    Where is the Workbook class defined? Is there doc for it?

    If you are getting errors, copy and paste the full text here.

  3. #3
    Join Date
    Jun 2008
    Posts
    54
    Rep Power
    0

    Default

    ok, sry, like always... i found this text on the internet, which is describing how to work with java, but i am not really getting into it...

    Reading Spreadsheets
    JExcelApi can read an Excel spreadsheet from a file stored on the local filesystem or from some input stream. The first step when reading a spreadsheet from a file or input stream is to create a Workbook. The code fragment below illustrates creating a workbook from a file on the local filesystem.

    import java.io.File;
    import java.util.Date;
    import jxl.*;
    ...

    Workbook workbook = Workbook.getWorkbook(new File("myfile.xls"));

    (NOTE: when creating a spreadsheet from a ServletInputStream you must remove the HTTP header information before creating the Workbook object.)

    Once you have accessed the workbook, you can use this to access the individual sheets. These are zero indexed - the first sheet being 0, the second sheet being 1, and so on. (You can also use the API to retrieve a sheet by name).

    Sheet sheet = workbook.getSheet(0);

    Once you have a sheet, you can then start accessing the cells. You can retrieve the cell's contents as a string by using the convenience method getContents(). In the example code below, A1 is a text cell, B2 is numerical value and C2 is a date. The contents of these cells may be accessed as follows

    etc.

    't know exactly what to do with my Workbook and my Sheet... is is ment to be a class or another method and if yes, what is going on in it... i actually haven't written so mcu yet, cos i don't understand the text completly...

    i know it is a really long question but maybe u can help me...

    thank you so much

    little_polarbear

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,449
    Rep Power
    25

    Default

    Sorry, I don't know anything about the jxl package or the Workbook class.
    You'll have to read its API doc to find out how to use it.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Did you read full text of the example you have found from the net? It should be explain well about this.

  6. #6
    Join Date
    Jun 2008
    Posts
    54
    Rep Power
    0

    Default

    i read it, but i am not understanding it completely... i mean they are talking about workbooks, i know what it means in generally but not how to handle it... do i have to create another class and then write the different methods in it... and if yes, how do i have to write these methods.... or do u know maybe a really good site on which it is really good explained.. i searched already for hours the net, but i am not finding sth. which is really helping me...

    little_polarbear

Similar Threads

  1. JSP To EXCEL
    By sureshsri1981 in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 09-24-2009, 10:12 PM
  2. Problem with Excel
    By a_gomathi in forum Forum Lobby
    Replies: 7
    Last Post: 05-30-2008, 07:53 AM
  3. Excel Column
    By Gajesh Tripathi in forum New To Java
    Replies: 2
    Last Post: 04-13-2008, 02:26 PM
  4. jsp excel
    By lak in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 03-29-2008, 10:53 AM
  5. ms excel
    By cool_gal in forum New To Java
    Replies: 9
    Last Post: 07-20-2007, 03:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •