Excel exports for .NET, done properly.
Sheetwright writes .xlsx files and reads back the ones it wrote. A small, MIT-licensed API over DocumentFormat.OpenXml for the exports every business application is eventually asked for.
1using Sheetwright;23using SpreadsheetPackage package = new();4SpreadsheetWorksheet sheet = package.Workbook.Worksheets.Add("Invoices");56sheet.Cells["A1:C1"].Style.Font.SetBold(true);7sheet.Cells[1, 1].LoadFromCollection(rows, printHeaders: true);8sheet.View.FreezePanes(2, 1);9sheet.Cells.AutoFitColumns();1011byte[] workbook = package.GetAsByteArray(); // doneExports people actually want to open
Whoever asks for an export wants column widths, a frozen header row, dates that read as dates and dropdowns where they will fill things in. CSV gives you none of that.
Familiar API
Uses the vocabulary .NET developers already know, such as Workbook.Worksheets.Add and Cells[1, 1].Value.
Formatting that matters
Styles, number formats, column widths, frozen panes, tables, data validation and conditional formatting.
Streaming for large reports
A stream writer emits one worksheet row by row, so very large exports do not exhaust memory.
Grid export helper
Describe columns once and write the same data as .xlsx or .csv.
MIT licensed
Free for commercial use, with one dependency and no second licence to buy later.
Modern targets
Targets net8.0, net9.0 and net10.0.
Questions or contributions?
Issues and pull requests are welcome on GitHub, or get in touch directly.