扫描二维码下载沐宇APP

沐宇

微信扫码使用沐宇小程序

沐宇

Java中workbook怎么获取sheet个数

扬州沐宇科技
2024-03-11 15:06:19
Java

要获取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的个数。

扫码添加客服微信