最佳答案
尝试下面的代码来识别 excelsheet 中的最后一行。下面的代码自动遍历所有行并识别所有列中的最后一行。
public static void main(String[] args) throws IOException {
// Making of excel file object
File myFile = new File(CommonMethods.getFilePath("testdata", "Sample.xlsx"));
FileInputStream fis = new FileInputStream(myFile);
XSSFWorkbook myWorkBook = new XSSFWorkbook(fis);
XSSFSheet mySheet = myWorkBook.getSheet("Logout");
XSSFRow row = null;
// Making the object of excel row
row = mySheet.getRow(0);
int colCount = row.getLastCellNum();
System.out.println("Column Count :- " + colCount);
int rowCount = mySheet.getLastRowNum() + 1;
System.out.println("Row Count :- " + rowCount);
}
关于java - 使用 Apache poi 在 excel 中查找特定列中的最后一行 no,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52678745/