You can use the following API to get the latest row number from a sheet in an Excel file
 

public int getLatestRowNum(String fileName, String sheetName) {
...
}