I try to get last row index in Excel file using apache poi but getLastRowNum() always returns wrong number of rows and the number is always 1048575 .
My xlsx is simple. It has only three rows with content.
Here is the relevant code snippet:
Sheet sheet = workbook.getSheetAt(0);
int rowNum = sheet.getLastRowNum();
log.info("LastRowNum " + rowNum);
Apache POI version:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.2</version>
</dependency>
OS: "Arch Linux"
JAVA Version:
openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8)
OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode, sharing)
I try upgrading apache poi but this doesn't fix the things.