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");