Writing a workbook and reading one back are the same contract in two directions, and a plain C# class is the whole column mapping. Four provider packages sit behind it, each with different memory and formatting trade-offs.
The interfaces below are the part that does not change when you swap the library underneath. Each provider then adds whatever extras its own library exposes.
IExcelService<T> writes a sheet from a list of T and reads one back into the same shape. Properties become columns.
An ExcelSheet carries a name and its rows; pass several and one call returns a multi-sheet workbook.
IExcelReader and IExcelWriter are separate interfaces, so an import-only service never gains the ability to write.
MiniExcel streams large files cheaply, ClosedXML and EPPlus do more formatting, NPOI covers the older formats. Registration decides.
Install the one that fits your runtime and licensing, and name it once at registration. Every package here is published on nuget.org.
The provider appears where the concrete class is constructed, and nowhere else. Always-current samples live in the package documentation.
// One typed row class is the whole mapping — in and out.
IExcelService<OrderRow> excel = new Regira.Office.Excel.MiniExcel.ExcelManager<OrderRow>();
IMemoryFile workbook = await excel.Create([
new ExcelSheet<OrderRow> { Name = "Orders", Data = rows }
]);
// Reading is the same contract in reverse.
var sheets = await excel.Read(uploaded);
IList<OrderRow> imported = sheets.FirstOrDefault()?.Data ?? [];Create an Excel file from structured data, and read one back to JSON — with no .NET at the calling end.
The free tier needs no key and is rate-limited to 5 requests / 60 s. A trial or commercial key removes the limit — send it in the X-License-Key header.