![]() |
VOOZH | about |
dotnet add package OfficeIMO.Excel --version 0.6.46
NuGet\Install-Package OfficeIMO.Excel -Version 0.6.46
<PackageReference Include="OfficeIMO.Excel" Version="0.6.46" />
<PackageVersion Include="OfficeIMO.Excel" Version="0.6.46" />Directory.Packages.props
<PackageReference Include="OfficeIMO.Excel" />Project file
paket add OfficeIMO.Excel --version 0.6.46
#r "nuget: OfficeIMO.Excel, 0.6.46"
#:package OfficeIMO.Excel@0.6.46
#addin nuget:?package=OfficeIMO.Excel&version=0.6.46Install as a Cake Addin
#tool nuget:?package=OfficeIMO.Excel&version=0.6.46Install as a Cake Tool
👁 nuget version
👁 nuget downloads
OfficeIMO.Excel is the main Excel package in the OfficeIMO family. It creates, edits, reads, and saves .xlsx workbooks without COM automation and without Microsoft Excel installed.
If OfficeIMO saves you time, please consider supporting the work through GitHub Sponsors or PayPal. PowerShell users should use PSWriteOffice for the PowerShell-facing experience.
dotnet add package OfficeIMO.Excel
using OfficeIMO.Excel;
using var document = ExcelDocument.Create("report.xlsx");
var sheet = document.AddWorkSheet("Data");
sheet.CellValue(1, 1, "Name");
sheet.CellValue(1, 2, "Value");
sheet.CellValue(2, 1, "Alpha");
sheet.CellValue(2, 2, 42);
sheet.AddTable("A1:B2", hasHeader: true, name: "DataTable", style: TableStyle.TableStyleMedium9);
sheet.AutoFitColumns();
document.Save();
The quick start covers the smallest workbook. These examples show common read, write, reporting, and automation workflows that belong in OfficeIMO.Excel.
using var document = ExcelDocument.Load("input.xlsx");
var sheet = document["Data"];
foreach (var row in sheet.Rows()) {
Console.WriteLine(row["Name"]);
}
using var document = ExcelDocument.Load("input.xlsx");
List<Person> people = document["Data"].RowsAs<Person>("A1:C100").ToList();
public sealed class Person {
public string Name { get; set; } = "";
public int Value { get; set; }
public string Status { get; set; } = "";
}
using var document = ExcelDocument.Load("sales.xlsx");
var rows = new DataTable();
rows.Columns.Add("Revenue", typeof(decimal));
rows.Columns.Add("Region", typeof(string));
rows.Rows.Add(150m, "APAC");
document["Sales"].AppendDataTableToTable(rows, "SalesTable");
document.Save();
using var document = ExcelDocument.Load("input.xlsx");
var sheet = document["Data"];
sheet.ValidationList("C2:C100", new[] { "New", "Processed", "Hold" });
sheet.Range("D2:D100").Validate.WholeNumberBetween(1, 10, errorMessage: "Use 1 through 10");
List<RowModel> rows = document.Read()
.Sheet("Data")
.Range("A1:C100")
.AsObjects<RowModel>()
.ToList();
public sealed class RowModel {
public string Name { get; set; } = "";
public string Status { get; set; } = "";
}
using OfficeIMO.Excel;
using var document = ExcelDocument.Create("dashboard.xlsx");
var sheet = document.AddWorkSheet("Summary");
sheet.CellValue(1, 1, "Quarter");
sheet.CellValue(1, 2, "Revenue");
sheet.CellValue(2, 1, "Q1");
sheet.CellValue(2, 2, 10);
sheet.CellValue(3, 1, "Q2");
sheet.CellValue(3, 2, 18);
sheet.CellValue(4, 1, "Q3");
sheet.CellValue(4, 2, 24);
sheet.CellValue(5, 1, "Q4");
sheet.CellValue(5, 2, 30);
sheet.AddTable("A1:B5", hasHeader: true, name: "RevenueTable", style: TableStyle.TableStyleMedium2);
sheet.ChartFromTable("RevenueTable")
.RevenueTrend("Revenue trend")
.Size(640, 320)
.At(row: 1, column: 5);
document.Save();
using OfficeIMO.Excel;
using System.Linq;
using var document = ExcelDocument.Create("pivot-report.xlsx");
var sheet = document.AddWorkSheet("Sales");
sheet.CellValue(1, 1, "Region");
sheet.CellValue(1, 2, "Product");
sheet.CellValue(1, 3, "Quarter");
sheet.CellValue(1, 4, "Revenue");
sheet.CellValue(2, 1, "EMEA");
sheet.CellValue(2, 2, "Alpha");
sheet.CellValue(2, 3, "Q1");
sheet.CellValue(2, 4, 125000);
sheet.CellValue(3, 1, "EMEA");
sheet.CellValue(3, 2, "Beta");
sheet.CellValue(3, 3, "Q1");
sheet.CellValue(3, 4, 94000);
sheet.CellValue(4, 1, "APAC");
sheet.CellValue(4, 2, "Alpha");
sheet.CellValue(4, 3, "Q2");
sheet.CellValue(4, 4, 141000);
sheet.AddTable("A1:D4", hasHeader: true, name: "SalesTable", style: TableStyle.TableStyleMedium4);
sheet.Pivot("A1:D4")
.Rows("Region")
.Columns("Quarter")
.Filters("Product")
.Sum("Revenue", "Total revenue", "#,##0")
.Layout(ExcelPivotLayout.Tabular)
.Style("PivotStyleMedium9")
.Captions(rowHeader: "Region", columnHeader: "Quarter", grandTotal: "Total")
.At("F2", "SalesPivot");
var pivot = sheet.GetPivotTables().Single(p => p.Name == "SalesPivot");
Console.WriteLine($"{pivot.Name}: {string.Join(", ", pivot.RowFields)}");
var chart = sheet.ChartFromTable("SalesTable")
.VarianceColumns("Revenue by region")
.At(row: 12, column: 1);
chart.SetPivotSource("SalesPivot");
document.Save();
Pivot support is useful but still marked partial in the compatibility matrix. It covers source-range pivots, row/column/page/data fields, styles, layouts, filters, calculated fields, grouping metadata, and readback. Slicers, timelines, external connections, and query-table authoring are still preserve-oriented or roadmap areas.
using var document = ExcelDocument.Load("report.xlsx");
var formulas = document.InspectFormulas();
Console.WriteLine(formulas.ToMarkdown());
foreach (var formula in formulas.Formulas.Where(f => !f.IsSupportedByOfficeIMO)) {
Console.WriteLine($"{formula.SheetName}!{formula.CellReference}: {formula.UnsupportedReason}");
}
int calculated = document.Calculate();
document.Save("report.xlsx", openExcel: false, options: new ExcelSaveOptions {
EvaluateFormulasBeforeSave = true,
ForceFullCalculationOnOpen = true
});
using System.Data;
using var document = ExcelDocument.Load("data.xlsx");
var sheet = document["Data"];
DataTable table = sheet.ToDataTable("A1:C100");
string csv = sheet.ToCsv("A1:C100");
string json = sheet.ToJson("A1:C100");
sheet.FromCsv("Name,Amount\nAlpha,10\nBeta,20", startRow: 5, startColumn: 1);
sheet.FromJson("[{\"Name\":\"Gamma\",\"Amount\":30}]", startRow: 8, startColumn: 1);
using var document = ExcelDocument.Load("invoice-template.xlsx");
int replacements = document.ApplyTemplate(new Dictionary<string, object?> {
["Invoice.Number"] = "INV-001",
["Customer.Name"] = "Adatum",
["Total"] = 123.45m
});
var template = document.InspectTemplate(new {
Invoice = new { Number = "INV-001" },
Customer = new { Name = "Adatum" },
Total = 123.45m
});
template.EnsureAllMarkersBound();
document.Save("invoice.xlsx");
using var document = ExcelDocument.Load("review.xlsx");
var sheet = document["Data"];
sheet.SetComment("A1", "Review total", author: "Alice", initials: "AA");
sheet.UpdateComments(new ExcelCommentFilter { TextContains = "total" }, "Total reviewed", author: "Carol", initials: "CC");
sheet.AddConditionalColorScale("C2:C100", "#FFF0F0", "#70AD47");
sheet.Range("D2:D100").ConditionalFormat.DataBar("#5B9BD5");
document.Save();
using var document = ExcelDocument.Create("large-report.xlsx");
document.Execution.Mode = ExecutionMode.Automatic;
document.Execution.MaxDegreeOfParallelism = Environment.ProcessorCount;
document.Execution.SaveWorksheetAfterAutoFit = false;
using var document = ExcelDocument.Create("composed-report.xlsx");
document.Compose("Report", composer => {
composer.Title("Demo Report", "Generated with OfficeIMO.Excel");
composer.Callout("info", "Heads up", "Generated via the fluent API");
composer.Section("Summary");
composer.PropertiesGrid(new (string, object?)[] {
("Author", "OfficeIMO"),
("Date", DateTime.Today.ToString("yyyy-MM-dd"))
});
var items = new[] {
new { Name = "Alice", Score = 90, Status = "OK" },
new { Name = "Bob", Score = 80, Status = "Warning" }
};
composer.TableFrom(items, title: "Scores", visuals: visuals => {
visuals.NumericColumnDecimals["Score"] = 0;
visuals.TextBackgrounds["Status"] = new Dictionary<string, string> {
["Warning"] = "#FFF3CD"
};
});
composer.HeaderFooter(header => header.Center("Demo Report").FooterRight("Page &P of &N"));
composer.Finish(autoFitColumns: true);
});
document.Save();
| Package | Use it for |
|---|---|
Excel to PDF export through OfficeIMO.Pdf, plus PDF table import to Excel. |
|
| Planning and exporting Excel content to Google Sheets. | |
| Benchmark harness for Excel workloads. |
OfficeIMO.Excel owns workbook modeling and Open XML read/write behavior.OfficeIMO.Excel.Pdf and OfficeIMO.Pdf.OfficeIMO.Excel.GoogleSheets.Docs/, not this README.netstandard2.0, net8.0, net10.0; net472 is included when building on Windows.| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 is compatible. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 3 NuGet packages that depend on OfficeIMO.Excel:
| Package | Downloads |
|---|---|
|
OfficeIMO.Reader
Unified, read-only document extraction facade for OfficeIMO (Word/Excel/PowerPoint/Markdown/PDF) intended for AI ingestion. |
|
|
OfficeIMO.Excel.Pdf
PDF converter for OfficeIMO.Excel - Export Excel workbooks to PDF using the first-party OfficeIMO.Pdf engine. |
|
|
OfficeIMO.Excel.GoogleSheets
Google Sheets planning and export scaffolding for OfficeIMO.Excel. |
Showing the top 1 popular GitHub repositories that depend on OfficeIMO.Excel:
| Repository | Stars |
|---|---|
|
EvotecIT/PSWriteOffice
PowerShell Module to create and edit Microsoft Word, Microsoft Excel, and Microsoft PowerPoint documents without having Microsoft Office installed.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 0.6.46 | 204 | 6/16/2026 |
| 0.6.45 | 325 | 6/16/2026 |
| 0.6.44 | 525 | 6/15/2026 |
| 0.6.43 | 623 | 6/13/2026 |
| 0.6.42 | 617 | 6/12/2026 |
| 0.6.41 | 544 | 6/9/2026 |
| 0.6.40 | 678 | 6/5/2026 |
| 0.6.39 | 1,389 | 5/27/2026 |
| 0.6.38 | 529 | 5/26/2026 |
| 0.6.37 | 451 | 5/26/2026 |
| 0.6.36 | 780 | 5/23/2026 |
| 0.6.35 | 482 | 5/22/2026 |
| 0.6.34 | 451 | 5/21/2026 |
| 0.6.33 | 449 | 5/21/2026 |
| 0.6.32 | 448 | 5/20/2026 |
| 0.6.31 | 462 | 5/19/2026 |
| 0.6.30 | 438 | 5/18/2026 |
| 0.6.29 | 704 | 5/16/2026 |
| 0.6.28 | 453 | 5/14/2026 |
| 0.6.27 | 647 | 5/14/2026 |