阅读量:2
要获取workbook中sheet的个数,可以使用Workbook类中的getNumberOfSheets()方法。示例如下:
Workbook workbook = new XSSFWorkbook(new FileInputStream("workbook.xlsx")); int numberOfSheets = workbook.getNumberOfSheets(); System.out.println("Number of sheets in the workbook: " + numberOfSheets);
以上代码会打印出workbook中sheet的个数。