使用POI读取Excel
jar包下载地址:https://download.csdn.net/download/Spring_East/33142735
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
public class XlsFile {
public static void main(String[] args) throws Exception {
// 获取文件路径
ReadXlsFile("D:/FileTest.xls");
}
/**
*
* @param path
* @throws Exception excel文件的读取
*/
public static void ReadXlsFile(String path) throws Exception {
FileInputStream is = new FileInputStream(path);
HSSFWorkbook sheets = new HSSFWorkbook(is);// 获取工作表
System.out.println("共有" + sheets.getNumber