Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine empty row?

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

like image 664
WelcomeTo Avatar asked Aug 31 '12 14:08

WelcomeTo


People also ask

How do I check if a row is empty?

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.

How do I identify empty rows in Excel?

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.

How do you find last empty row in Excel VBA?

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”).


1 Answers

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; } 
like image 95
Takaitra Avatar answered Oct 20 '22 19:10

Takaitra