Results 1 to 2 of 2
Thread: JXL read excel documents
- 01-09-2009, 01:56 AM #1
Member
- Join Date
- Jan 2009
- Posts
- 2
- Rep Power
- 0
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());
}
}
- 09-08-2010, 12:42 AM #2
Similar Threads
-
Importing documents
By stefanybaez in forum Advanced JavaReplies: 2Last Post: 12-22-2008, 07:24 PM -
how to insert date field read from Excel using JExcel to database
By saran123 in forum JDBCReplies: 1Last Post: 10-10-2008, 08:47 AM -
How to read data from excel and store it in db
By saran123 in forum New To JavaReplies: 5Last Post: 10-03-2008, 10:19 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks