FastExcel: The Successor to EasyExcel – Features, Migration Guide, and Code Samples
FastExcel, the newly renamed successor to EasyExcel, offers high‑performance Excel read/write, full compatibility, new features like row‑specific reading and PDF conversion, and provides detailed migration instructions with Maven/Gradle dependencies and code examples for Java developers.
On November 6, Alibaba announced that the popular Java Excel library EasyExcel will cease active development and enter maintenance mode, receiving only bug fixes without new features.
EasyExcel is renowned for its speed and low memory usage, capable of reading a 75 MB (460,000 rows × 25 columns) Excel file using just 16 MB of memory in 23 seconds.
The project currently has over 30k stars and 7.5k forks on GitHub, with more than 3,000 issues closed over six years.
Good news: the author has launched a new project called FastExcel , emphasizing high performance when handling Excel files.
Open‑source repository: https://github.com/CodePhiliaX/fastexcel
FastExcel will remain free and open‑source under the permissive MIT license, making it suitable for any commercial scenario.
Key advantages of FastExcel include:
Full compatibility with all EasyExcel features, enabling seamless migration.
Migration requires only changing the package name and Maven dependency.
Additional innovations and improvements over EasyExcel.
Version 1.0.0 introduces reading specific rows and converting Excel to PDF.
Future plans involve continuously adding new features to enhance user experience and utility.
Core features:
High‑performance read/write that significantly reduces memory consumption compared to traditional Excel libraries.
Simple, intuitive API for quick integration into projects.
Streaming operations that minimize memory usage when processing tens or hundreds of thousands of rows.
It is recommended to use the latest FastExcel version for performance optimizations, bug fixes, and new functionalities.
FastExcel builds on Apache POI; if your project already includes POI components, you may need to exclude POI jars manually.
If you use Maven, add the following dependency:
<dependency>
<groupId>cn.idev.excel</groupId>
<artifactId>fastexcel</artifactId>
<version>1.0.0</version>
</dependency>If you use Gradle, add this configuration:
dependencies {
implementation 'cn.idev.excel:fastexcel:1.0.0'
}Differences between EasyExcel and FastExcel:
FastExcel supports all EasyExcel functionalities with better performance and stability.
The APIs are identical, allowing seamless switching.
FastExcel will continue to receive updates, bug fixes, performance optimizations, and new features.
1. Change Dependency
Replace the EasyExcel dependency with FastExcel as follows:
<dependency>
<groupId>cn.idev.excel</groupId>
<artifactId>fastexcel</artifactId>
<version>1.0.0</version>
</dependency>2. Modify Code
Replace EasyExcel package imports with FastExcel package imports:
// Replace EasyExcel package imports with FastExcel
import cn.idev.excel.*;3. Directly Use FastExcel Without Code Changes
You can depend on FastExcel directly; EasyExcel and FastExcel can coexist, but long‑term replacement with FastExcel is recommended.
4. Prefer Using FastExcel Classes
For compatibility, EasyExcel classes are retained, but it is advised to use FastExcel classes moving forward, as new features will be added only to FastExcel.
Simple example: reading an Excel file
// Implement ReadListener to process data
public class DemoDataListener implements ReadListener
{
@Override
public void invoke(DemoData data, AnalysisContext context) {
System.out.println("Parsed a record: " + JSON.toJSONString(data));
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
System.out.println("All data parsed!");
}
}
public static void main(String[] args) {
String fileName = "demo.xlsx";
// Read Excel file
FastExcel.read(fileName, DemoData.class, new DemoDataListener()).sheet().doRead();
}Simple example: creating an Excel file
// Data class
public class DemoData {
@ExcelProperty("String Title")
private String string;
@ExcelProperty("Date Title")
private Date date;
@ExcelProperty("Number Title")
private Double doubleData;
@ExcelIgnore
private String ignore;
}
private static List
data() {
List
list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
DemoData d = new DemoData();
d.setString("String" + i);
d.setDate(new Date());
d.setDoubleData(0.56);
list.add(d);
}
return list;
}
public static void main(String[] args) {
String fileName = "demo.xlsx";
// Create a sheet named "Template" and write data
FastExcel.write(fileName, DemoData.class).sheet("Template").doWrite(data());
}Past content links:
SpringBoot + minio + kkfile file preview
ZhiHu discussion on 12306 ticket system
Linux disguised as Windows 11
16 SpringBoot extension points
Architecture Digest
Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.