How I can determine empty rows in .xls documents using Apache POI?
Check if multiple cells in a row are blank=AND(G49=””,K49=””,M49=””) (again note that there is no space between the inverted commas and if you want a 1 or 0 add a — in front). This is useful if there are a few cells that you want to check.
Find Blank Rows Using Go To Special Select the columns or range of cells that includes blanks. Click Find & Select > Go To Special on the Home tab. In the pop-up window, mark the option for Blanks. Click OK.
Follow the below steps to get the last non-empty row in excel using VBA code: Step 1: Define a variable again as Long. Step 2: Start storing the value to the variable Last_Row using the assignment operator. Step 3: Start Typing Range(“A:A”).
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; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With