0

I'm trying to check whether cell of an empty excel worksheet is null or not by using "==" in if but getting Null pointer exception. Why? Is there a way to do it successfully. I've used POI JARs.

FileInputStream fi = new FileInputStream(new File(sss));

XSSFWorkbook workbook = new XSSFWorkbook(fi);

//Get first/desired sheet from the workbook
XSSFSheet sheet = workbook.getSheetAt(0);

row=sheet.getRow(0);
if(row.getCell(0)==null)
  System.out.println("Cell is null");
else
  System.out.println("Cell is not null");   
ian0411
  • 4,115
  • 3
  • 25
  • 33
user2044296
  • 504
  • 1
  • 7
  • 18

0 Answers0