Does Apache POI provide any function for all of us to count the amount of "not-null" rows inside a sheet of the Stand out file?
At the very first time, I've an Stand out sheet with 10 data rows, the function worksheet.getPhysicalNumberOfRows() returns the precise number (10). But next, I remove 3 rows, then that function still will get 10 rows. Maybe the entire quantity of rows was cached anywhere by POI. Exactly what does getPhysicalNumberOfRows() mean? Since it's API referred to: "Returns the amount of physically defined rows (NOT the amount of rows within the sheet)", but I don't know very well what "physically defined" mean. Are you able to assist me to about this problem?
Many thanks!

Should you remove the rows via worksheet.removeRow(Row row), then your physical row count ought to be 7.

POI utilizes a map to keep the rows of the sheet. This map may be the physical part. See

Regarding the realistically null rows, try

int notNullCount = 0;
Sheet sheet = wb.getSheetAt(0);
for (Row row : sheet) {
    for (Cell cell : row) {
        if (cell.getCellType() != Cell.CELL_TYPE_BLANK) {
            if (cell.getCellType() != Cell.CELL_TYPE_STRING ||
                cell.getStringCellValue().length > 0) {

Should you consider the code from the POI 3.8 beta 3, you'll notice that getting rid of a row also needs to remove its record. As a result, the amount of physical rows within the file is going lower too

I'd suggest you attempt having a more recent version of POI

To count the amount of non empty rows inside a file, make a move like Amadeus indicates and loop within the rows around the sheet and appearance should they have cells.