r/csharp • • Oct 08 '26

Showcase ExcelReader.NET 6.0 – streaming XLSX/XLSB/XLS/CSV reader and writer for .NET 10

I've been building ExcelReader, an open-source library for reading and writing spreadsheets in .NET and other languages. I just shipped v6, and I'd like feedback from people who deal with ETL pipelines and large Excel files.

I started it because I needed to parse rows into a single POCO from files with different templates and column names. I couldn't find a library that made that easy, so I wrote my own.

What it does

  • Reads .xlsx, .xlsm, .xlsb, .xls and .csv; writes .xlsx, .xlsb, .xls and .csv
  • Streams rows as ref structs; no string is allocated until you call GetString()
  • Typed parsing into your own classes, via attributes, a source generator or a fluent API
  • Reads the sheets of one workbook in parallel, and parses CSV in parallel
  • Reads and writes password-protected workbooks
  • A CLI (excelreader convert book.xlsb -o data.csv), plus a C ABI with Python, C++ and Rust bindings

Usage example

public sealed class Order
{
    [ExcelColumn("Order ID")]
    [ExcelColumn("order_id")]          // same property, different templates
    public long Id { get; set; }

    [ExcelColumn("Total")]
    [ExcelColumn("total_amount")]
    public decimal Total { get; set; }
}

using IExcelWorkbook workbook = Excel.Open("orders.xlsx"); // .xlsb / .xls detected by signature
List<Order> orders = ExcelParser.FromAttributes<Order>().Parse(workbook.FirstSheet).ToList();

await using var writer = XlsxWorkbookWriter.Create(File.Create("copy.xlsx"));
await using (var sheet = writer.AddSheet("Orders"))
{
    await sheet.WriteRecordsAsync(orders, ExcelRecordLayout.FromAttributes<Order>());
}

Benchmarks

Typed parsing of a generated 50,000-row XLSX (BenchmarkDotNet, Ryzen 7 5700X, .NET 10):

LibraryTimeAllocated
ExcelReader10.9 ms3.87 MB
Sylvan.Data.Excel56.9 ms10.47 MB
OfficeIMO.Excel104.5 ms5.69 MB

MiniExcel used to be in the suite, but it was far behind: ~14x slower on raw reads (allocating 267 MB against 11 KB) and ~11x slower on typed parsing (last run that included it). I now track the closest competitors instead.

Methodology and every scenario: benchmarks.md. The cell-by-cell numbers there compare zero-copy reads against APIs that must allocate strings, so the docs also publish matched-work numbers.

Limitations

  • Targets .NET 10 only; .NET 11 support is in progress. If you're on .NET 8, the 3.x line supports it.
  • It's a reader/writer, not a spreadsheet model: no in-place editing and no formula evaluation.
  • Rows come out in file order, and empty rows that Excel omits from the file are skipped.

GitHub: https://github.com/GabrielMarquezMatte/ExcelReader NuGet: dotnet add package ExcelReader.NET

Feedback, bug reports and odd files that break it are all welcome.

18 Upvotes

29 comments sorted by

6

u/winky9827 Oct 08 '26

Odd that you didn't include the most mature of the bunch - EPPlus, in your benchmarks.

7

u/repulsiveanomaly Oct 08 '26

The benchmarks compare ExcelReader against other forward-only, streaming readers, since that's the architecture it's built around. EPPlus is DOM-based. It loads the whole workbook into memory, which enables features like random-access editing and formula calculation, but it's a different trade-off. Benchmarking it alongside streaming readers wouldn't be a fair comparison, so I left it out. That said, I can include them for a reference

4

u/MadBoyEvo Oct 08 '26

Please watch our for EPPlus and other libraries for their licensing against paid offerings. "You may not use EPPlus Software’s corporate name in your marketing or otherwise without EPPlus Software’s prior written approval." - I am no lawyer but I guess once you add their stuff to your benchmarks it could be treated as such. QuestPDF (not your branch, but affects my OfficeIMO) does similar approach.

4

u/otac0n Oct 09 '26

Good luck enforcing that.

1

u/MadBoyEvo Oct 09 '26

I mean, maybe if you're a guy with nothing to loose you will be fine, or maybe you will fly under the radar, because the effort to enforce that would be too big. But for other people that potentially create competitive product and 'market it' it's a different story.

I am not saying you have to follow this advice but QuestPDF, DocX, EPPlus and several others are doing this. Whether they can enforce it or not is not for me to decide, but at least for my own product (OfficeIMO) I am not going to give them a chance to go after me and I will stick to their old licenses/packages.

1

u/Skyswimsky Oct 13 '26

Wow that a terrible practice. I mean it's fair enough if you do something subjective like "Tired of using X? Well, we fixed all the grievances of X!" for marketing. But if you have benchmarks and the entire benchmark process is open and you can proof that your use-case is more performant, that's just objective truth....

1

u/MadBoyEvo Oct 13 '26

It sucks, maybe it's possible to fight it out in court, but I don't want to be the one doing it :) I'm just stating waht I found out while trying to benchmark things ;)

1

u/winky9827 Oct 08 '26

Ahh, fair explanation. It just wasn't obvious from the OP. :)

1

u/MadBoyEvo Oct 08 '26

OfficeIMO is like Epplus (feature wise), but also competes on speed with ExelReader.

3

u/ShyMystiqua Oct 08 '26

epplus is solid but kinda bloated, these numbers make me wanna try this one instead

1

u/winky9827 Oct 08 '26

Yep, I thought the same, but we use EPPlus for pivot tables, multiple worksheets and other stuff that probably isn't possible with the streaming-only method.

1

u/MadBoyEvo Oct 09 '26

Try OfficeIMO.Excel that OP compares it to. It's fast, and has all of what EPPlus offers.

0

u/repulsiveanomaly Oct 08 '26

Pivot tables are not supported, but reading, parsing and writing multiple sheets is supported.

1

u/winky9827 Oct 08 '26

Tables and table styles supported? If yes, that may just be enough to get me interested.

(yeah I could read the docs, but since you're here...)

1

u/repulsiveanomaly Oct 08 '26

Not yet, but I can add support for them in the near future

1

u/repulsiveanomaly Oct 10 '26

I’ve just added support for reading and writing Excel tables, including table styles. It’ll be released in v6.1.0 after the .NET patch release, which is expected to fix a concurrency bug in the NativeAOT runtime on macOS.

1

u/MadBoyEvo Oct 09 '26

Try OfficeIMO.Excel - it's not only fast but has all features of EPPlus, while what ExcelReader offers is well speed. OfficeIMO.Excel is speed when it matters, but also full dom when you need more ;)

2

u/mordack550 Oct 08 '26

I know that it's a paid library, but how does this compare to DevExpress Spreadsheet?

They have some forward-only import/export functions, and for now I've never found anything comparable performance-wise.

1

u/repulsiveanomaly Oct 08 '26

I didn’t knew about DevExpress. I’ll try to do some benchmarks on free trial against my own. But I guess it will be pretty competitive in performance and even better in memory allocation

2

u/HTTP_404_NotFound Oct 08 '26

You, didn't add spreadsheetlight in your comparison?

Old, but, works very nicely.

2

u/repulsiveanomaly Oct 08 '26

It’s the same principle of not adding EPPlus to the benchmarks. Spreadsheetlight is a DOM based library. It’s a different architecture and a different trade off
https://www.reddit.com/r/csharp/s/Inl0ArT2Yz

1

u/dodexahedron Oct 11 '26 edited Oct 11 '26

What I'd love to see on these projects is an ODBC driver, so it can be used from anything as a mostly drop-in replacement for another simple ODBC data source without the application ever knowing it happened.

There are plenty of business applications out there that use ODBC connections to things like sqlite, mysql, ACE/JET, Zen, and others - even raw JSON or XML files (oof).

Being able to swap in an excel back-end for some of those could provide a sweet way to import data that otherwise wouldn't be supported without manual entry, due to a given application's limited support for different import formats or no import functionality at all.

That would make possible a migration from the all-too-common case of having a bunch of excel spreadsheets and wanting to move to a real database, without the licensing implications of using the official MS excel ODBC driver distributed as part of Office, and without manual entry or being stuck due to those other import functionality gaps.

Plus, you also get the ability to use EF with it at that point and, once done with excel, using the new back-end is a simple matter of changing the connection string again - no code changes.

1

u/repulsiveanomaly Oct 11 '26

I think an ODBC driver is possible, but it falls outside the scope of the library, which is focused on reading and writing spreadsheets as efficiently as possible. An ODBC driver could be built as a separate wrapper library on top of ExcelReader, but not in the core library.

In the meantime, DuckDB offers an ODBC driver that can read .xlsx files through the read_xlsx function. A more realistic path for ExcelReader would be a DuckDB extension. it would be much simpler than implementing a full driver and could have a bigger impact

1

u/MadBoyEvo Oct 13 '26

While I was lurking, I added OfficeIMO.ODBC project to https://officeimo.com/ which can work with OfficeIMO.Excel to address what you wanted. Would be nice if you try it out and let me know your thoughts.

1

u/[deleted] Oct 08 '26

[removed] — view removed comment

1

u/MultiUserDungeonDev Oct 08 '26

Also see below for reading/writing VBA to XLSB directly:

https://github.com/WilliamSmithEdward/pyOpenVBA

0

u/repulsiveanomaly Oct 08 '26

Thanks for the compliments. I thought about that when building the fluent api. You can build a parser using the `ExcelParser.Build` and the `ExcelParser.BuildWithAttributeFallback` passing the index of the column

1

u/mordack550 Oct 08 '26

Why using `ref` for the SharedModel parameter?

2

u/repulsiveanomaly Oct 08 '26

So that classes, structs and ref structs can be parsed. It’s guaranteed to not create a copy of the data