jeudi 17 octobre 2019

I am not able to read blank cells from xlsx sheet in selenium using apache POI.(PS : I want to skip blank rows)

I am trying to identify black cell/row and skip it.

i am simply trying to read it using .getStringCellValue(); traditional way of POI.

FileInputStream fis = new FileInputStream("c:\\abc.xlsx");
           Workbook workbook = new XSSFWorkbook(fis);
           Sheet sheet = workbook.getSheetAt(0);

           int lastRow = sheet.getLastRowNum();
           System.out.println("Last row- "+lastRow);
           Row row = sheet.getRow(5);

           Cell cell = row.getCell(1);
           String value = cell.getStringCellValue();
           System.out.println(value);

I am getting Error on Clonsole as below

Exception in thread "main" java.lang.NullPointerException at test.Excel_test.main(Excel_test.java:31)

Aucun commentaire:

Enregistrer un commentaire