第一种方法:使用Excel4J依赖
<dependency>
<groupId>com.github.crab2died</groupId>
<artifactId>Excel4J</artifactId>
<version>3.0.0</version>
</dependency>
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
@Slf4j
public class demo {
public static void main(String[] args){
String filePath="F:\\cs.xlsx";
String sheetName="Sheet1";
List<List<String>> list=getExcelData(filePath,sheetName);
System.out.println(list.size());
}
private static List<List<String>> getExcelData(String filePath,St