Dear EasyExcel users:
First of all, we would like to express our deepest gratitude for your long-term trust and support of EasyExcel. During this journey, EasyExcel has been fortunate to accompany many developers and companies to grow together, and has witnessed the efficient completion of countless data processing tasks.
Recently, we have noticed that more excellent data processing tools and solutions have appeared on the market, providing users with richer choices. In order to ensure that every user can enjoy the best experience and service, we have decided to take an important measure: EasyExcel will gradually enter maintenance mode and give users sufficient time to evaluate and migrate to other products. At the same time, we also welcome and are happy to see the use and migration experience of similar excellent products shared within and outside the community to jointly promote the healthy development of the technology ecosystem.
Please be assured that even if we enter maintenance mode, we will still ensure that the basic functions of EasyExcel run stably and bug fixes will be made, but we will no longer actively add new functions. We believe that through everyone's joint efforts, every piece of code and every project will continue to shine in their respective fields and serve a wider user group. Thank you again for your support and understanding of EasyExcel! We hope that in the vast world of technology, we can join hands again in new forms to create brilliance.
I wish you all the best in your future work and study!
Sincerely, Alibaba EasyExcel Team
The more famous frameworks for Java parsing and generating Excel include Apache poi and jxl. But they all have a serious problem that they consume a lot of memory. POI has a set of SAX mode APIs that can solve some memory overflow problems to a certain extent, but POI still has some flaws, such as the decompression and storage of the 07 version of Excel. It is done in memory, and memory consumption is still very large.
easyexcel has rewritten poi's analysis of the 07 version of Excel. A 3M excel still requires about 100M of memory to parse with POI sax. Using easyexcel can reduce it to a few MB, and no matter how large the excel is, there will be no memory overflow; version 03 relies on POI's sax mode encapsulates model conversion in the upper layer, making it easier and more convenient for users.
Of course, there is also a speed mode that is faster, but the memory usage will be a little more than 100M.
< dependency >
< groupId >com.alibaba</ groupId >
< artifactId >easyexcel</ artifactId >
< version >4.0.3</ version >
</ dependency >
Open source is not easy. If you think EasyExcel is still helpful to your work, please help by clicking a star in the upper right corner. Your support is the biggest motivation to make EasyExcel better.
issues
You can try to search for the issue in the following 2 links. If it does not exist, you can try to create issue
.
issues
issues
Solving problems through issues
can be reviewed by students who encounter the same problem later, so this method is highly recommended.
Regardless of github
or gitee
, someone will answer your questions regularly. If it is more urgent, you can ask the DingTalk group Aite group leader after raising issue
and send issue
address to help solve it.
The QQ
company doesn't allow you to use it, but I sometimes look at it, but the core is definitely still DingTalk.
Join DingTalk or QQ groups to get help after reading the announcement.
I highly recommend the DingTalk group, but QQ
company does not allow you to use it. Of course, the QQ group will also have enthusiastic netizens to help solve the problem.
QQ1 group (full): 662022184
QQ2 group (full): 1097936804
QQ3 group (full): 453928496
QQ4 group (full): 496594404
QQ5 group (full): 451925680
QQ6 group (full): 784741035
QQ7 group (full): 667889383
QQ8 group: 113968681
DingTalk 1 group (full): 21960511
DingTalk 2 group (full): 32796397
DingTalk 3 group (full): 33797247
DingTalk 4 group (full): 33491624
DingTalk 5 group (full): 32134498
DingTalk 6 group (full): 34707941
DingTalk 7 group (full): 35235427
DingTalk 8 group (full): 44752220
DingTalk 9 group (full): 11045002277
DingTalk 10 group (full): 27360019755
DingTalk 11 group (full): 24330026964
DingTalk 12 group (full): 27210038956
DingTalk 13 group: 83695000992
Ji Pengfei (Yuxiao), Zhuang Jiaju
Demo code address: https://github.com/alibaba/easyexcel/blob/master/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/demo/read/ReadTest.java
Detailed document address: https://easyexcel.opensource.alibaba.com/docs/current/quickstart/read
/**
* 最简单的读
* <p>1. 创建excel对应的实体对象 参照{@link DemoData}
* <p>2. 由于默认一行行的读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener}
* <p>3. 直接读即可
*/
@ Test
public void simpleRead () {
String fileName = TestFileUtil . getPath () + "demo" + File . separator + "demo.xlsx" ;
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
EasyExcel . read ( fileName , DemoData . class , new DemoDataListener ()). sheet (). doRead ();
}
Demo code address: https://github.com/alibaba/easyexcel/blob/master/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/demo/write/WriteTest.java
Detailed document address: https://easyexcel.opensource.alibaba.com/docs/current/quickstart/write
/**
* 最简单的写
* <p>1. 创建excel对应的实体对象 参照{@link com.alibaba.easyexcel.test.demo.write.DemoData}
* <p>2. 直接写即可
*/
@ Test
public void simpleWrite () {
String fileName = TestFileUtil . getPath ()+ "write" + System . currentTimeMillis ()+ ".xlsx" ;
// 这里 需要指定写用哪个class去读,然后写到第一个sheet,名字为模板 然后文件流会自动关闭
// 如果这里想使用03 则 传入excelType参数即可
EasyExcel . write ( fileName , DemoData . class ). sheet ( "模板" ). doWrite ( data ());
}
Demo code address: https://github.com/alibaba/easyexcel/blob/master/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/demo/web/WebTest.java
/**
* 文件下载(失败了会返回一个有部分数据的Excel)
* <p>
* 1. 创建excel对应的实体对象 参照{@link DownloadData}
* <p>
* 2. 设置返回的 参数
* <p>
* 3. 直接写,这里注意,finish的时候会自动关闭OutputStream,当然你外面再关闭流问题不大
*/
@ GetMapping ( "download" )
public void download ( HttpServletResponse response ) throws IOException {
// 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman
response . setContentType ( "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" );
response . setCharacterEncoding ( "utf-8" );
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
String fileName = URLEncoder . encode ( "测试" , "UTF-8" ). replaceAll ( " \ +" , "%20" );
response . setHeader ( "Content-disposition" , "attachment;filename*=utf-8''" + fileName + ".xlsx" );
EasyExcel . write ( response . getOutputStream (), DownloadData . class ). sheet ( "模板" ). doWrite ( data ());
}
/**
* 文件上传
* <p>1. 创建excel对应的实体对象 参照{@link UploadData}
* <p>2. 由于默认一行行的读取excel,所以需要创建excel一行一行的回调监听器,参照{@link UploadDataListener}
* <p>3. 直接读即可
*/
@ PostMapping ( "upload" )
@ ResponseBody
public String upload ( MultipartFile file ) throws IOException {
EasyExcel . read ( file . getInputStream (), UploadData . class , new UploadDataListener ( uploadDAO )). sheet (). doRead ();
return "success" ;
}