ExcelFlow 1.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package ExcelFlow --version 1.1.1
                    
NuGet\Install-Package ExcelFlow -Version 1.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ExcelFlow" Version="1.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ExcelFlow" Version="1.1.1" />
                    
Directory.Packages.props
<PackageReference Include="ExcelFlow" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ExcelFlow --version 1.1.1
                    
#r "nuget: ExcelFlow, 1.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ExcelFlow@1.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ExcelFlow&version=1.1.1
                    
Install as a Cake Addin
#tool nuget:?package=ExcelFlow&version=1.1.1
                    
Install as a Cake Tool

ExcelFlow

NuGet Version .NET Native AOT Ready License: MIT

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 & Zero-Allocation: Zero reflection and zero boxing at runtime. Parsers and Writers are fully generated at compile time as strictly typed instructions without any garbage allocations on the hot path.
  • Extreme Performance & Low Memory: Built on top of ExcelDataReader and OpenXml with 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]. You can map columns by Name, by Index, and define whether they are required.

using ExcelFlow;

namespace MyApp;

[ExcelFlowSerializable]
public partial class SalesRecord
{
    [ExcelColumn("Transaction ID")]
    public int TransactionId { get; set; }

    [ExcelColumn("Product Name", IsRequired = true)] // Fail-fast if missing
    public string? ProductName { get; set; }

    [ExcelColumn(Index = 2)] // Direct mapping by column index (0-based)
    public decimal Amount { get; set; }

    [ExcelColumn("Date")]
    public DateTime Date { get; set; }
}

Note: The class must be partial to allow the Source Generator to extend it.

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);
}

💉 Dependency Injection (ASP.NET Core)

ExcelFlow provides a built-in interface IExcelFlowService for easy Dependency Injection, making your code perfectly testable.

// Program.cs
builder.Services.AddExcelFlow();

Inject and use it in your controllers or services:

public class ReportController
{
    private readonly IExcelFlowService _excel;

    public ReportController(IExcelFlowService excel)
    {
        _excel = excel;
    }

    public async Task<IActionResult> Upload(IFormFile file)
    {
        var data = await _excel.Read<SalesRecord>(file.OpenReadStream()).ToListAsync();
        return Ok(data);
    }
}

📄 License

ExcelFlow is licensed under the MIT License. See the LICENSE file for more details.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 152 7/15/2026
1.1.2 125 7/7/2026
1.1.1 120 7/7/2026
1.1.0 126 7/6/2026
1.0.3 133 6/2/2026
1.0.2 130 6/2/2026
1.0.1 130 6/2/2026
1.0.0 129 6/2/2026