Results 1 to 2 of 2
  1. #1
    ironicending is offline Member
    Join Date
    Jan 2009
    Posts
    2
    Rep Power
    0

    Default JXL read excel documents

    This bit of code is from a midterm project of mine, I'm trying to be able to read an excel sheet and change the first two columns into arraylists. But my problem is that i cant seem to get the Workbook to be able to find or read the xl sheet. could please someone tell me what i'm doin wrong?


    private ArrayList<String> words = new ArrayList<String>();
    private ArrayList<String> answers = new ArrayList<String>();

    public ExcelConverter(Workbook a)
    {
    //calls up the excel document,
    WorkbookSettings ws = new WorkbookSettings();
    ws.setLocale(new Locale("en", "EN"));
    Workbook workbook = Workbook.getWorkbook(new File("test.xls"),ws);


    Sheet sheet = workbook.getSheet(0);
    for(int i = 0; sheet.getCell(0,i).getContents().isEmpty()== false; i++)
    {
    words.add(i,sheet.getCell(0,i).getContents());
    }
    for(int i = 0; sheet.getCell(1,i).getContents().isEmpty()== false; i ++)
    {
    answers.add(i,sheet.getCell(1,i).getContents());
    }
    }

  2. #2
    gafa's Avatar
    gafa is offline Senior Member
    Join Date
    Jun 2010
    Posts
    107
    Rep Power
    0

Similar Threads

  1. Importing documents
    By stefanybaez in forum Advanced Java
    Replies: 2
    Last Post: 12-22-2008, 07:24 PM
  2. Replies: 1
    Last Post: 10-10-2008, 08:47 AM
  3. How to read data from excel and store it in db
    By saran123 in forum New To Java
    Replies: 5
    Last Post: 10-03-2008, 10:19 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
  •