BugBaster
BugBaster

Reputation: 71

Read couple of columns/rows data from excels and get as a list

Read couple of columns/rows data from excels and get as a list.

I have 17 Columns and 2 row of data as xls, i would like to read the excel and store the data as a list to compare the results with other data.

Thanks in advance.

Upvotes: 0

Views: 44

Answers (1)

avk
avk

Reputation: 871

First Download jxl here

Next try something like this

Workbook workBook
try {
  w = Workbook.getWorkbook([File object]);
  Sheet sheet = workBook.getSheet(0);

  for (int j = 0; j < sheet.getColumns(); j++) {
    for (int i = 0; i < sheet.getRows(); i++) {
      Cell cell = sheet.getCell(j, i);
      cell.getContents());
    }
 }

Upvotes: 2

Related Questions