一、pom.xml依赖
<!--EasyExcel-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>1.1.1</version>
</dependency>
二、读入
//读取excel文件
@Test
public void readExcel() throws Exception {
ExcelReader excelReader = new ExcelReader(new FileInputStream("g:/excel/my_2007.xlsx"), ExcelTypeEnum.XLSX, null, new ExcelListener());
excelReader.read(new Sheet(1, 1,User2.class));
}
测试结果:
三、导出
@Test
public void writeWithoutHead() throws IOException {
OutputStream out = new FileOutputStream("G:\\excel\\test8.xlsx");
ExcelWriter writer =