0

I need to determine if a row in excel sheet is empty or not without iterating over whole row. Iterating over row to determine if whole row is empty and then reading that row to get all data will increase the time of file reading operation as I need to deal with huge files.
Existing solution in foll. articles require iterating over whole row.

How to determine empty row?
Checking for empty row in excel using apache poi methods

Please suggest an efficient way to fulfill this use case

Update: is empty means no values

Ravi
  • 3
  • 2
  • 1
    `row.getPhysicalNumberOfCells()` -> `Gets the number of defined cells (NOT number of cells in the actual row!).That is to say if only columns 0,4,5 have values then there would be 3.` should help you, though I am not sure what happens if lets say, we set a value to A1 and then remove it, if the cell is still defined or not – XtremeBaumer Jan 17 '23 at 08:27
  • Define "is empty" - no values? no values or styles? never any values or styles? (Excel may have a different idea to you about what that means...) – Gagravarr Jan 17 '23 at 09:06
  • ok @Gagravarr is empty means no values – Ravi Jan 17 '23 at 09:28
  • You'll need to read each row in turn then - rows can exist just to hold styling information or the "ghosts" of past values (blank cells), even if they don't have any values in them – Gagravarr Jan 17 '23 at 11:05

0 Answers0