ExcelFlow 1.0.3

dotnet add package ExcelFlow --version 1.0.3
                    
NuGet\Install-Package ExcelFlow -Version 1.0.3
                    
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.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ExcelFlow" Version="1.0.3" />
                    
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.0.3
                    
#r "nuget: ExcelFlow, 1.0.3"
                    
#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.0.3
                    
#: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.0.3
                    
Install as a Cake Addin
#tool nuget:?package=ExcelFlow&version=1.0.3
                    
Install as a Cake Tool

ExcelFlow is an ultra-fast, memory-efficient, and strictly typed Excel (.xlsx) reader and writer for modern .NET.

It provides an elegant, LINQ-like API similar to Entity Framework, but without the massive memory footprint of traditional DOM-based libraries like ClosedXML or EPPlus.

💡 Why ExcelFlow?

Traditional Excel libraries load the entire document into memory to build a DOM (Document Object Model). Reading or exporting a 500,000-row file can easily consume 1.5 GB of RAM and crash your microservices with an OutOfMemoryException.

ExcelFlow solves this by using:

  1. Forward-Only Streaming: It reads and writes data row-by-row. Memory consumption stays completely flat (around ~50 MB) regardless of file size.
  2. Expression Trees: No slow Reflection in loops. Mapping is compiled into raw machine code at runtime, allowing you to process over 160,000 rows per second.
  3. Modern Fluent API & Async: Designed for modern .NET 8+. Fully supports IAsyncEnumerable for non-blocking asynchronous streaming directly from HTTP requests or file streams.

📦 Installation

Install via NuGet Package Manager:

dotnet add package ExcelFlow

📖 Quick Start

  1. Define your model Use the [ExcelColumn] attribute to map Excel headers to your C# properties. Supports Nullable types and robust Date parsing (OADate / ISO).
using ExcelFlow;

public class SalesRow
{
    [ExcelColumn("Manager Name")]
    public string Manager { get; set; }
    
    public decimal Amount { get; set; }
    
    public DateTime? Date { get; set; } // Nullable supported!
}

2. Read from Excel (Streaming) Thanks to yield return, data is streamed lazily. You can use standard LINQ methods without loading the entire file into memory.

// 2. Read from Excel (Fluent API & Streaming)
// Read synchronously into memory
var topSales = await Excel.Read<SalesRow>("huge_report.xlsx")
                          .FromSheet("Sales")
                          .ToListAsync();

// OR Stream asynchronously (Zero-allocation approach for Web APIs)
await using var stream = File.OpenRead("huge_report.xlsx");
var asyncStream = Excel.Read<SalesRow>(stream)
                       .FromSheet("Sales")
                       .AsAsyncEnumerable(); // Reads row-by-row lazily

await foreach (var row in asyncStream)
{
    // Process or save to database without loading the whole file into RAM
    await _dbContext.Sales.AddAsync(row);
}

Safe Parsing & Error Handling: Excel data is often dirty. You can pass a callback to gracefully catch parsing errors without crashing your app:

// Safe Parsing & Error Handling
// Excel data is often dirty. Pass a callback to catch parsing errors without crashing your app:
var errors = new List<ExcelParseError>();

var data = await Excel.Read<SalesRow>("dirty_data.xlsx")
                      .OnError(err => errors.Add(err)) // Catch errors gracefully!
                      .ToListAsync();

// err contains RowNumber, ColumnName, ExpectedType, and the RawValue.

3. Write to Excel (Export) Export millions of rows straight from your database to an Excel file or HTTP Response Stream. No intermediate memory buffers.

// 3. Write to Excel (Export)
var myData = new List<SalesRow> { ... };

// 1. Export directly to a file
Excel.Write(myData)
     .ToSheet("2024 Report")
     .ToFile("export.xlsx");

// 2. Stream directly to an HTTP Response (ASP.NET Core)
[HttpGet("download")]
public IActionResult DownloadReport()
{
    var query = _dbContext.Sales.AsNoTracking();
    var stream = new MemoryStream();
    
    Excel.Write(query)
         .ToSheet("Export")
         .ToStream(stream);
    
    stream.Position = 0;
    return File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "report.xlsx");
}

📊 Benchmarks

Test case: 500,000 rows, 3 columns (String, Decimal, DateTime).

⏳ Running ClosedXML... Sum: 1312507875000.0 Time: 7371 ms Memory (RAM): 491.77 MB

🚀 Running ExcelFlow... Sum: 1312507875000.0 Time: 1362 ms Memory (RAM): 1.76 MB

🏆 FINAL COMPARISON: Speedup: 5.4x faster! Memory saved: 278.7x less RAM!

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.0.3 42 6/2/2026
1.0.2 45 6/2/2026
1.0.1 45 6/2/2026
1.0.0 46 6/2/2026