ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files. It aims to provide an intuitive and user-friendly interface to dealing with the underlying OpenXML API.
Install the library through .NET CLI
C:\source> dotnet add package ClosedXML
ClosedXML allows you to create Excel files without the Excel application. The typical example is creating Excel reports on a web server.
using var workbook = new XLWorkbook(); var worksheet = workbook.AddWorksheet("Sample Sheet"); worksheet.Cell("A1").Value = "Hello World!"; worksheet.Cell("A2").FormulaA1 = "MID(A1, 7, 5)"; workbook.SaveAs("HelloWorld.xlsx");
These docs are very much a work in progress. If you’d like to contribute, click on the Edit on GitHub link in the right top corner.
- Organizing Worksheets
- Bulk insert data
- Cell styles