ExcelFlow 1.1.0
See the version list below for details.
dotnet add package ExcelFlow --version 1.1.0
NuGet\Install-Package ExcelFlow -Version 1.1.0
<PackageReference Include="ExcelFlow" Version="1.1.0" />
<PackageVersion Include="ExcelFlow" Version="1.1.0" />
<PackageReference Include="ExcelFlow" />
paket add ExcelFlow --version 1.1.0
#r "nuget: ExcelFlow, 1.1.0"
#:package ExcelFlow@1.1.0
#addin nuget:?package=ExcelFlow&version=1.1.0
#tool nuget:?package=ExcelFlow&version=1.1.0
ExcelFlow
ExcelFlow is a high-performance, strictly typed, and memory-efficient Excel (.xlsx) reader and writer designed specifically for modern .NET.
Built from the ground up to support Native AOT and Assembly Trimming, ExcelFlow eliminates runtime reflection entirely by leveraging Roslyn Source Generators. It uses forward-only streaming to process hundreds of thousands of rows with a minimal memory footprint.
🚀 Key Features
- 100% Native AOT & Trim Compatible: Zero reflection at runtime. Mapping logic is converted into highly optimized, strongly typed delegates at compile time using Source Generators.
- Extreme Performance & Low Memory: Built on top of
ExcelDataReaderandOpenXmlwith a strict forward-only streaming approach. Read and write massive datasets without loading the entire file into RAM. - Fluent Data Validation: Define business rules inline. Filter out invalid rows automatically.
- Graceful Error Handling: Catch parsing or type-conversion errors via
.OnError()callbacks instead of dealing with random runtime exceptions. - Skip Rows & Layout Resilience: Easily skip title rows or descriptive headers before parsing the actual table structure.
- Asynchronous Streaming: First-class support for
IAsyncEnumerable<T>to stream rows asynchronously (ideal for web APIs and microservices).
📦 Installation
dotnet add package ExcelFlow
📖 Quick Start
1. Define your model
Mark your class with [ExcelFlowSerializable] to trigger the Source Generator. Map properties to Excel columns using [ExcelColumn].
using ExcelFlow;
namespace MyApp;
[ExcelFlowSerializable]
public partial class SalesRecord
{
[ExcelColumn("Transaction ID")]
public int TransactionId { get; set; }
[ExcelColumn("Product Name")]
public string? ProductName { get; set; }
[ExcelColumn("Amount")]
public decimal Amount { get; set; }
[ExcelColumn("Date")]
public DateTime Date { get; set; }
}
Note: The class must be
partialand cannot be nested inside another class, ensuring the Source Generator can extend it properly.
2. Reading Data
Read the data synchronously into a List<T>, or stream it asynchronously with rich validation and error handling.
using ExcelFlow;
var records = await Excel.Read<SalesRecord>("sales_data.xlsx")
.FromSheet("Q1_Sales")
.SkipRows(2) // Skip title and description rows before the header
.Validate(row => row.Amount >= 0, "Amount cannot be negative")
.OnError(error =>
{
Console.WriteLine($"[Warning] Row {error.RowNumber}: Column '{error.ColumnName}' failed. " +
$"Expected {error.ExpectedType}, but got '{error.RawValue}'.");
})
.ToListAsync(); // Or use .AsAsyncEnumerable() for true streaming
3. Writing Data
Export collections to Excel instantly with zero boxing and zero reflection.
using ExcelFlow;
List<SalesRecord> data = GetSalesData();
Excel.Write(data)
.ToSheet("Exported_Sales")
.ToFile("report.xlsx");
🛠 Advanced: True Async Streaming
If you are building a memory-constrained worker service or web endpoint, you can process rows one-by-one as they are parsed, keeping your RAM usage completely flat regardless of file size:
await using var fileStream = File.OpenRead("huge_dataset.xlsx");
var asyncStream = Excel.Read<SalesRecord>(fileStream)
.AsAsyncEnumerable(cancellationToken);
await foreach (var record in asyncStream)
{
await _database.InsertAsync(record);
}
📄 License
ExcelFlow is licensed under the MIT License. See the LICENSE file for more details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- DocumentFormat.OpenXml (>= 3.5.1)
- ExcelDataReader (>= 3.7.0)
-
net8.0
- DocumentFormat.OpenXml (>= 3.5.1)
- ExcelDataReader (>= 3.7.0)
-
net9.0
- DocumentFormat.OpenXml (>= 3.5.1)
- ExcelDataReader (>= 3.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.