Tester_at_work
Tester_at_work

Reputation: 99

Empty cell in Excel returns Null (Java, POI)

I wish to display the values from Excel. My issue is I am not sure why I am getting "null" as well.

enter image description here

Upvotes: 1

Views: 2703

Answers (1)

dgg
dgg

Reputation: 164

You're getting the cell object. Do a null-check and access the value of the cell - something like this:

Cell cell = rowAmt.getCell(0);
if (cell != null) {
    System.out.println(cell.getStringCellValue());
    /*
     * for numbers: cell.getNumericCellValue();
     * for booleans: cell.getBooleanCellValue();
     */
}

Upvotes: 2

Related Questions