Fast, Concise, Java tool for processing Excel files that solves memory overflow issues with large files.
FastExcel will always be free and open source, use the business-friendly Apache license, making it suitable for any commercial scenarios. This provides developers and enterprises with great freedom and flexibility. We plan to introduce more new features in the future to continually enhance user experience and tool usability. Stay tuned to "Programmer Xiao Lan's" public account for updates on the development of FastExcel. FastExcel is committed to being your best choice for handling Excel files.
- High-performance Reading and Writing: FastExcel focuses on performance optimization, capable of efficiently handling large-scale Excel data. Compared to some traditional Excel processing libraries, it can significantly reduce memory consumption.
- Simplicity and Ease of Use: The library offers a simple and intuitive API, allowing developers to easily integrate it into projects, whether for simple Excel operations or complex data processing.
- Stream Operations: FastExcel supports stream reading, minimizing the problem of loading large amounts of data at once. This design is especially important when dealing with hundreds of thousands or even millions of rows of data.
The following table lists the minimum Java language version requirements for each version of the FastExcel library:
Version | JDK Version Support Range | Notes |
---|---|---|
1.2.x | JDK8 - JDK21 | |
1.1.x | JDK8 - JDK21 | |
1.0.x | JDK8 - JDK21 |
We strongly recommend using the latest version of FastExcel, as performance optimizations, bug fixes, and new features in the latest version will enhance your experience.
Currently, FastExcel uses POI as its underlying package. If your project already includes POI-related components, you will need to manually exclude POI-related jar files.
For detailed update logs, refer to Details of version updates. You can also find all available versions in the Maven Central Repository.
If you are using Maven for project building, add the following configuration in the pom.xml
file:
<dependency>
<groupId>cn.idev.excel</groupId>
<artifactId>fastexcel</artifactId>
<version>version</version>
</dependency>
If you are using Gradle for project building, add the following configuration in the build.gradle file:
dependencies {
implementation 'cn.idev.excel:fastexcel:version'
}
Below is an example of reading an Excel document:
// Implement the ReadListener interface to set up operations for reading data
public class DemoDataListener implements ReadListener<DemoData> {
@Override
public void invoke(DemoData data, AnalysisContext context) {
System.out.println("Parsed a data entry" + 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();
}
Below is a simple example of creating an Excel document:
// Sample 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;
}
// Prepare data to write
private static List<DemoData> data() {
List<DemoData> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
DemoData data = new DemoData();
data.setString("String" + i);
data.setDate(new Date());
data.setDoubleData(0.56);
list.add(data);
}
return list;
}
public static void main(String[] args) {
String fileName = "demo.xlsx";
// Create a "Template" sheet and write data
FastExcel.write(fileName, DemoData.class).sheet("Template").doWrite(data());
}
Contributors are welcomed to join the FastExcel project. Please check Contributing Guide about how to contribute to this project.
Thank you to all the people who already contributed to FastExcel!
Note: Showing the first 100 contributors only due to GitHub image size limitations
The project is licensed under the Apache License 2.0.