依赖的jar包
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
POIUtil工具类
package com.tao.springstarter.common.util;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
* POI工具类
*/
public class POIUtil {
public final static String XLS = "xls";
public final static String XLSX = "xlsx";
/**
* * 读取excel文件
*
* @param excelFile excel文件
* @param startRow 读取数据的起始行, 行号从0开始
* @return
* @throws IOException
*/