Iterate through an Excel document

pom.xml:

    <dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>3.9</version>
    </dependency>
    <dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>3.9</version>
    </dependency>

java

        Workbook wb=new XSSFWorkbook(new FileInputStream("test.xlsx"));
        Sheet ws=wb.getSheetAt(wb.getActiveSheetIndex());
        int rowIndex=1;
        while (ws.getRow(rowIndex)!=null && rowIndex<100){
            Row row=ws.getRow(rowIndex);
            System.out.println(row.getCell(0).getStringCellValue());
            rowIndex++;
        }
No votes yet