Lightweight, extremely fast and memory efficient Excel output library for .NET and .NET Core applications. Build your Excel reports in fraction of seconds with no memory footprint thanks to skipping XML serialization and streaming data directly to the file.
SwiftExcel is available as a NuGet package. You can install it using the NuGet Package Console window:
PM> Install-Package SwiftExcel
using (var ew = new ExcelWriter("C:\\temp\\test.xlsx"))
{
for (var row = 1; row <= 100; row++)
{
for (var col = 1; col <= 10; col++)
{
ew.Write($"row:{row}-col:{col}", col, row);
}
}
}
var sheet = new Sheet
{
Name = "Monthly Report",
ColumnsWidth = new List<double> { 10, 12, 8, 8, 35 }
};
var ew = new ExcelWriter("C:\\temp\\test.xlsx", sheet);
using (var ew = new ExcelWriter("C:\\temp\\test.xlsx"))
{
for (var row = 1; row <= 20; row++)
{
ew.Write(row.ToString(), 1, row, DataType.Number);
}
ew.WriteFormula(FormulaType.Average, 1, 22, 1, 1, 20);
ew.WriteFormula(FormulaType.Count, 1, 23, 1, 1, 20);
ew.WriteFormula(FormulaType.Max, 1, 24, 1, 1, 20);
ew.WriteFormula(FormulaType.Sum, 1, 25, 1, 1, 20);
}
SwiftExcel has incredible performance due to ignoring XML serialization and streaming data directly to the file. Below is a performance test creating a document with 100 000 rows and 100 columns compared to other popular Excel output libraries on Nuget.
Execution Time | Memory Usage | |
---|---|---|
SwiftExcel | 6.1 sec | 19 mb |
FastExcel | 31.1 sec | 3200 mb |
EPPlus | 44.2 sec | 2900 mb |
Syncfusion.XlsIO | 73.3 sec | 2700 mb |
IronXL.Excel | 306.8 sec | 7700 mb |
Microsoft Interop Excel | >3 hours | 27 mb |
Check out the .Pro version for advanced features like working with multiple sheets or applying custom styles.