packageq;importjava.io.File;importjava.io.FileInputStream;importjava.io.IOException;importorg.apache.poi.hssf.usermodel.HSSFWorkbook;importorg.apache.poi.ss.usermodel.Cell;importorg.apache.poi.ss.usermodel.Sheet;importorg.apache.poi.ss.usermodel.Workbook;importorg.apache.poi.xssf.usermodel.XSSFWorkbook;public classff
{public static void main(String[] args) throwsIOException
{
String excelFilePath= "C:\\Users\\del\\Desktop\\Book1.xlsx";
File file= new File(excelFilePath); //根据上面的路径文件,创建一个文件对象
FileInputStream inputStream= new FileInputStream(file); //用于读取excel文件
Workbook workBook= null;
String fileExtensionName= excelFilePath.substring(excelFilePath.indexOf(".")); //截取文件名,获取 . 后面(包括.)的内容
System.out.println(fileExtensionName);//打印内容.xlsx
if ( fileExtensionName.equals(".xlsx"))
{
workB