Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Repository files navigation

FluentExcel

NuGet NuGet Downloads CI License: MIT .NET 10 Ready

Free, MIT-licensed fluent Excel generation for .NET. No commercial subscription required — ever.

Why FluentExcel?

EPPlus — the most widely used .NET Excel library — has required a paid annual subscription for any commercial use since v5 (free only under the restrictive Polyform Noncommercial license). ClosedXML is a solid free MIT alternative, but its API is low-level and imperative. FluentExcel is a declarative, fluent builder — in the same style as FluentPdf — built on top of ClosedXML, giving you EPPlus-like ergonomics with zero licensing risk, regardless of your company's size or revenue.

Document.Create(workbook =>
{
    workbook.Sheet("Orders", sheet =>
    {
        sheet.Table(orders, table => table
            .Column("Order #", o => o.OrderNumber)
            .Column("Customer", o => o.CustomerName)
            .Column("Total", o => o.Total));

        sheet.AutoFitColumns();
    });
}).SaveAs("orders.xlsx");

Install

dotnet add package Swevo.FluentExcel

Core concepts

  • Document.Create(...) — top-level entry point; add one or more Sheet(...) calls.
  • sheet.Row(...) — appends one row; each row.Cell(...) call writes the next value and returns a CellBuilder for styling (.Bold(), .Italic(), .Color(...), .Background(...), .NumberFormat(...), .AlignLeft/Center/Right(), .Border(), .WrapText()).
  • sheet.Table(items, table => ...) — declares columns with a header label and a per-row value selector; writes a bold header row plus one row per item. Freezes the header row and adds an auto-filter by default (opt out with .NoFreezeHeader() / .NoAutoFilter()).
  • sheet.EmptyRow(), sheet.FreezeTopRow(), sheet.ColumnWidth(...), sheet.AutoFitColumns() — layout helpers.
  • document.SaveAs(path) / document.ToByteArray() — write to disk or get an in-memory .xlsx byte array (e.g. to return from an API endpoint).

Example: styled report

Document.Create(workbook =>
{
    workbook.Sheet("Summary", sheet =>
    {
        sheet.Row(row => row.Cell("Monthly Report").Bold().FontSize(16));
        sheet.EmptyRow();

        sheet.Table(lineItems, table => table
            .Column("Category", x => x.Category)
            .Column("Amount", x => x.Amount));
    });
}).SaveAs("report.xlsx");

Apply cell-level formatting anywhere via the returned CellBuilder:

row.Cell(total).NumberFormat("$#,##0.00").Bold().AlignRight();
row.Cell(status).Background(status == "Overdue" ? "#FFC7CE" : "#C6EFCE");

Design goals

  • MIT licensed, forever. No commercial tier, no revenue threshold.
  • Thin layer, solid foundation. All OOXML/file-format complexity is handled by ClosedXML; FluentExcel only adds the declarative builder API on top.
  • Familiar if you already use FluentPdf. Same Document.Create(...) entry point and decorator-style chaining conventions across the Swevo document-generation packages.

Known limitations (v1.0)

  • No charts, pivot tables, or conditional formatting yet — use ClosedXML directly for those (FluentExcel documents are plain XLWorkbooks under the hood, but they aren't exposed publicly in v1.0).
  • Table(...) always starts at column 1 of the current row; multi-table-per-row layouts require hand-built Row(...) calls instead.

Contributions and issues for any of the above are welcome.

Related Packages

Package Downloads Description
Swevo.FluentPdf Downloads A free, MIT-licensed fluent PDF generation library for

💼 Need .NET consulting?

I'm the author of FluentExcel and a suite of compile-time source generators (AutoWire, AutoMap.Generator) and 28+ Polly v8 resilience packages. I'm available for consulting on Polly v8 resilience, Azure cloud architecture, and clean .NET design.

→ solidqualitysolutions.com · LinkedIn

Also by the same author

🌐 Full suite overview: swevo.github.io

Package Description
FluentPdf Free, MIT-licensed fluent PDF generation — alternative to QuestPDF's revenue-based commercial license.
AutoBus Free, MIT-licensed message bus — alternative to MassTransit's commercial license.
EFCore.Outbox Transactional outbox pattern for EF Core.
Swevo.AutoAssert Free, MIT-licensed fluent assertions — alternative to FluentAssertions' commercial license.
EFCore.BulkOperations Free, MIT-licensed bulk insert/update/delete for EF Core.
AutoWire Compile-time DI auto-registration.
AutoDispatch.Generator Compile-time CQRS dispatcher — free alternative to MediatR's commercial license.

License

MIT © Justin Bannister

About

Free, MIT-licensed fluent Excel generation for .NET - alternative to EPPlus's commercial subscription license

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages