Nov 25
|
In previous posts we have covered opening Excel files, and accessing sheets. Now we need to move onto reading the rows and cells in that sheet.
FileInputStream in = new FileInputStream(file); Workbook workbook = WorkbookFactory.create(in); int nsheets = workbook.getNumberOfSheets(); for (int i=0; i<nsheets; i++) { Sheet sheet = workbook.getSheetAt(i); for (Row row : sheet) { for (Cell cell : row) { // Do what you want with the cell value } } }