public SourceExcelDoc(Display display) { FileInputStream file; this.display = display; try { display.addMessage("Reading Source Excel Doc"); file = new FileInputStream(new File(CONFIG.getSourceInputFile())); workbook = WorkbookFactory.create(file); display.addMessage("Source Excel file successfully read"); } catch (Exception e) { // TODO Auto-generated catch block display.addMessage(e.getMessage()); } }
public ArrayList<Row> getRows(String sheetName) { Sheet sheet = getSheet(sheetName); ArrayList<Row> rows = new ArrayList<Row>(); Iterator<Row> rowIterator = sheet.rowIterator(); int counter = 0; Cell cell; while (rowIterator.hasNext()) { if (counter >= CONFIG.getSourceStartPoint() - 1) { Row row = rowIterator.next(); if (!row.getCell(0).getStringCellValue().equals("")) rows.add(row); else break; } else { rowIterator.next(); } counter++; } return rows; }