说明:平时项目中经常有需要把excel表格中的数据导入库中,或者需要把查询出来的数据导出到excel文件中,今天就来介绍阿里的 easyexcel 的用法
一、SpringBoot集成EasyExcel,引入如下依赖
<!-- alibaba easyexcel -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>2.2.10</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
二、编写 EasyExcelUtil 工具类:
1、创建解析监听类,读取 excel 表格中的数据,会通过监听类处理读取到的数据进行持久化或者存储到集合中以供后续操作使用,监听