How to determine empty row?

MyTitle picture MyTitle · Aug 31, 2012 · Viewed 76k times · Source

How I can determine empty rows in .xls documents using Apache POI?

Answer

Takaitra picture Takaitra · May 6, 2013

I'm using the following method in my POI project and it's working well. It is a variation of zeller's solution.

public static boolean isRowEmpty(Row row) {
    for (int c = row.getFirstCellNum(); c < row.getLastCellNum(); c++) {
        Cell cell = row.getCell(c);
        if (cell != null && cell.getCellType() != Cell.CELL_TYPE_BLANK)
            return false;
    }
    return true;
}