Runnable C# examples for IronXL, a .NET Excel library that reads, writes, and edits XLSX, XLS, CSV, and TSV files without Microsoft Office or COM Interop.
dotnet add package IronXL.Excelusing IronXL;
WorkBook workbook = WorkBook.Load("data.xlsx");
WorkSheet sheet = workbook.WorkSheets.First();
// Read cells using Excel-like addressing
string customerName = sheet["A2"].StringValue;
decimal total = sheet["B2:B100"].Sum();
// Write a value and save
sheet["C1"].Value = "Updated";
workbook.SaveAs("updated.xlsx");Ranges support the LINQ-style aggregations you'd expect (Sum, Max, Min, Average) and iterate cell-by-cell. Worksheets can also be projected into System.Data.DataTable and System.Data.DataSet for integration with existing .NET data pipelines.
For production use, set a license key via License.LicenseKey = "YOUR-KEY". Without one, saved files include a watermark sheet.
Each folder contains a self-contained .NET project you can open and run:
examples/— focused snippets demonstrating individual featureshow-to/— task-oriented guides for specific spreadsheet operationsquickstart/— end-to-end project scaffoldstutorials/— longer walkthroughs combining multiple features
- Reading and writing XLSX, XLS, XLSM, CSV, and TSV files
- Cell formulas with automatic recalculation on edit
- Range arithmetic: Sum, Max, Min, Average, and LINQ-style aggregations
- Cell formatting: fonts, colors, borders, alignment, number formats
- Sorting ranges, columns, and rows
- DataSet and DataTable conversion for ADO.NET integration
- Excel encryption, decryption, and password protection
- Export to JSON
- Conditional formatting and named ranges
.NET 8, 7, 6, 5, .NET Core, .NET Standard, and .NET Framework. Windows, macOS, Linux, Docker, Azure, and AWS. See the installation docs for environment-specific notes.
- Full documentation: ironsoftware.com/csharp/excel/docs
- API reference: ironsoftware.com/csharp/excel/object-reference/api
- Issues with these examples: file directly on this repository
- Product support: support@ironsoftware.com
This repository is maintained by Iron Software. IronXL is a commercial library — see licensing for terms and trial details.