EasyExcel使用
时间: 2023-06-28 22:08:00 浏览: 122
EasyExcel是一个Java的Excel操作工具,可以帮助我们快速地读取、写入Excel数据。以下是一些EasyExcel的使用示例:
1. 读取Excel数据:
```java
List<Object> data = EasyExcel.read(fileName).sheet().doReadSync();
```
2. 写入Excel数据:
```java
EasyExcel.write(fileName).sheet().doWrite(data);
```
3. 读取指定Sheet的数据:
```java
List<Object> data = EasyExcel.read(fileName, sheetNo).head(headClazz).sheet().doReadSync();
```
4. 写入指定Sheet的数据:
```java
EasyExcel.write(fileName, sheetNo).head(headClazz).sheet().doWrite(data);
```
5. 自定义读取Excel数据的监听器:
```java
EasyExcel.read(fileName, listener).sheet().doReadSync();
```
6. 自定义写入Excel数据的监听器:
```java
EasyExcel.write(fileName, clazz).registerWriteHandler(writeHandler).sheet().doWrite(data);
```
以上仅是EasyExcel的一些基本使用,更多详细的用法可以查看官方文档。
阅读全文
相关推荐
![java](https://img-home.csdnimg.cn/images/20250102104920.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)