{"id":1319,"date":"2025-09-29T00:00:00","date_gmt":"2025-09-28T22:00:00","guid":{"rendered":"https:\/\/demo.sidekick.be\/itenium\/create-xlsx-excel-with-closedxml-csharp\/"},"modified":"2025-11-28T13:31:40","modified_gmt":"2025-11-28T12:31:40","slug":"create-xlsx-excel-with-closedxml-csharp","status":"publish","type":"post","link":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/","title":{"rendered":"Create Excels with C# and ClosedXML: A tutorial"},"content":{"rendered":"<h1 id=\"closedxml\">ClosedXML<\/h1>\n<p><a href=\"https:\/\/github.com\/ClosedXML\/ClosedXML\" class=\"github\"><img decoding=\"async\" src=\"https:\/\/img.shields.io\/github\/stars\/ClosedXML\/ClosedXML.svg?style=social&amp;label=Star\" \/><\/a><a href=\"https:\/\/github.com\/ClosedXML\/ClosedXML\">ClosedXML\/ClosedXML<\/a>: ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files.<\/p>\n<pre><code class=\"language-sh\">Install-Package ClosedXML\n<\/code><\/pre>\n<p>It basically provides a more intuitive and user-friendly interface compared to the <a href=\"https:\/\/github.com\/dotnet\/Open-XML-SDK\">OpenXML API<\/a> it\u2019s built on top off. Hence the name \ud83d\ude09<\/p>\n<h2 id=\"mit-licensed\">MIT Licensed<\/h2>\n<p>I used to be a big fan of EPPlus but since it is no longer free, this aims to be a pretty much 1 to 1 conversion of our EPPlus blog series.<\/p>\n<p>If you\u2019re migrating, AI is pretty good at converting EPPlus code to ClosedXML, for most (simple) use cases, it just works!<\/p>\n<h1 id=\"documentation\">Documentation<\/h1>\n<p>Documentation is a bit in limbo. The <strong>Github wiki<\/strong> contains most examples but they are not always up to date, as for some things the API has changed slightly.<\/p>\n<p>The <strong>ReadTheDocs<\/strong> is the new documentation and while it does go into a lot more detail for some particularities, it does not cover everything and has a lot less examples.<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/closedxml\/closedxml\/wiki\">Github Wiki<\/a>: Lots of example code here\n<ul>\n<li><a href=\"https:\/\/github.com\/closedxml\/closedxml\/wiki\/Data-Validation\">Validation<\/a>: <code>cell.DataValidation<\/code> \u2b95 <code>cell.CreateDataValidation()<\/code><\/li>\n<li><a href=\"https:\/\/github.com\/closedxml\/closedxml\/wiki\/Styles-Alignment\">Comments<\/a>: <code>cell.Comment<\/code> \u2b95 <code>cell.CreateComment()<\/code><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/docs.closedxml.io\/en\/latest\/\">Read the docs<\/a>: Newer documentation, more details but less examples<\/li>\n<\/ul>\n<p>There is also the <a href=\"https:\/\/github.com\/ClosedXML\/ClosedXML\/tree\/develop\/ClosedXML.Examples\"><code>ClosedXML.Examples<\/code><\/a> console project in the source code.<\/p>\n<pre><code class=\"language-ps1\">git clone https:\/\/github.com\/closedxml\/closedxml\ncd closedxml\ndotnet run --project ClosedXML.Examples --framework net8.0\n<\/code><\/pre>\n<p>This creates all the example Excels in <code>ClosedXML.Examples\/bin\/Debug\/net8.0\/Created<\/code>, you can then compare the code with the actual output and go from there!<\/p>\n<h1 id=\"basic-usage\">Basic Usage<\/h1>\n<pre><code class=\"language-c#\">using ClosedXML.Excel;\n\nusing var workbook = new XLWorkbook();\nIXLWorksheet sheet = workbook.AddWorksheet(\"MySheet\");\n\n\/\/ Setting &amp; getting values\nIXLCell firstCell = sheet.Cell(1, 1);\nfirstCell.Value = \"will it work?\";\nsheet.Cell(\"A2\").FormulaA1 = \"CONCATENATE(A1,\" ... Of course it will!\")\";\nAssert.That(firstCell.GetString(), Is.EqualTo(\"will it work?\"));\n\n\/\/ Numbers\nvar moneyCell = sheet.Cell(\"A3\");\nmoneyCell.Style.NumberFormat.Format = \"$#,##0.00\";\n\/\/ Or use a predefined style\n\/\/ See: https:\/\/github.com\/closedxml\/closedxml\/wiki\/NumberFormatId-Lookup-Table\nmoneyCell.Style.NumberFormat.NumberFormatId = (int)XLPredefinedFormat.Number.Precision2WithSeparator;\nmoneyCell.Value = 1500.25M;\n\n\/\/ Easily write any Enumerable to a sheet\nvar data = new[]\n{\n  new { FunctionName = \"CHAR\", Description = \"Returns the character specified by the code number\" },\n  new { FunctionName = \"FIND\", Description = \"Finds one text value within another (case-sensitive)\" },\n};\nsheet.Cell(\"A4\").InsertTable(data, true);\nsheet.Cell(\"A12\").InsertData(data);\n\n\/\/ Styling cells\nvar someCells = sheet.Cells(\"A1,A4:B4\");\nsomeCells.Style.Font.Bold = true;\nsomeCells.Style.Font.SetFontColor(XLColor.Ivory);\nAssert.That(XLColor.Ivory, Is.EqualTo(XLColor.FromColor(Color.Ivory)));\n\/\/ XLColor also has static methods FromArgb, FromHtml, FromKnownColor etc\n\/\/ See: https:\/\/github.com\/closedxml\/closedxml\/wiki\/ClosedXML-Predefined-Colors\nsomeCells.Style.Fill.SetPatternType(XLFillPatternValues.Solid);\nsomeCells.Style.Fill.BackgroundColor = XLColor.Navy;\n\n\/\/ Full control over filtering\n\/\/ See: https:\/\/docs.closedxml.io\/en\/latest\/features\/autofilter.html\nint lastCol = sheet.ColumnsUsed().Last().ColumnNumber();\nsheet.Range(1, 1, 1, lastCol).SetAutoFilter();\n\nsheet.ColumnsUsed().AdjustToContents();\nworkbook.SaveAs(\"basicUsage.xslx\");\n<\/code><\/pre>\n<h2 id=\"fluent-syntax\">Fluent Syntax<\/h2>\n<p>At first I didn\u2019t quite understand why there were both properties and \u201csetter functions\u201d for so many things. It is a bit overkill but it does allow the following code:<\/p>\n<pre><code class=\"language-c#\">someRange.Style.Fill.BackgroundColor = XLColor.FromHtml(\"#F0F4FF\");\nsomeRange.Style.Border.RightBorder = XLBorderStyleValues.Thin;\nsomeRange.Style.Border.RightBorderColor = XLColor.FromHtml(\"#D4D4D4\");\n<\/code><\/pre>\n<p>To also be written like:<\/p>\n<pre><code class=\"language-c#\">someRange.Style\n  .Fill.SetBackgroundColor(XLColor.FromHtml(\"#F0F4FF\"))\n  .Border.SetRightBorder(XLBorderStyleValues.Thin)\n  .Border.SetRightBorderColor(XLColor.FromHtml(\"#D4D4D4\"));\n<\/code><\/pre>\n<p>Which does look better! \ud83d\ude03<\/p>\n<h1 id=\"examples\">Examples<\/h1>\n<h2 id=\"selecting-cells\">Selecting Cells<\/h2>\n<pre><code class=\"language-c#\">using var workbook = new XLWorkbook();\nvar sheet = workbook.Worksheets.Add(\"MySheet\");\n\n\/\/ One cell\nIXLCell cellA2 = sheet.Cell(\"A2\");\nvar alsoCellA2 = sheet.Cell(2, 1);\nAssert.That(cellA2.Address.ToString(), Is.EqualTo(\"A2\"));\nAssert.That(cellA2.Address, Is.EqualTo(alsoCellA2.Address));\n\n\/\/ Get the column from a cell\nAssert.That(cellA2.Address.ColumnNumber, Is.EqualTo(1));\n\/\/ To really get the column: sheet.Column(1) or sheet.Column(\"A\")\n\n\/\/ A range\nIXLRange ranger = sheet.Range(\"A2:C5\");\nvar sameRanger = sheet.Range(2, 1, 5, 3);\nAssert.That(ranger.RangeAddress, Is.EqualTo(sameRanger.RangeAddress));\n\n\/\/sheet.Cells(\"A1,A4\") \/\/ Just A1 and A4\n\/\/sheet.Ranges(\"A1,A4\") \/\/ Same, but as a range\n\/\/sheet.Row(1) \/\/ A row\n\/\/sheet.Range(\"A:B\") \/\/ Two columns\n\n\/\/ Linq\n\/\/ Not so performant to use standard linq\nsheet.Range(\"A1:A5\").Cells().Where(cell =&gt; cell.HasComment);\n\n\/\/ Better to use the ClosedXML specific functions\n\/\/ Also: RowsUsed, FirstColumnUsed, ...\nsheet.Range(\"A1:A5\").Cells(cell =&gt; cell.HasComment);\nvar usedBold = sheet.CellsUsed(x =&gt; x.Style.Font.Bold);\n\n\/\/ Dimensions used\nAssert.That(sheet.LastRowUsed(), Is.Null);\nAssert.That(sheet.LastColumnUsed(), Is.Null);\n\nranger.Value = \"pushing\";\nvar usedRange = sheet.RangeUsed();\nAssert.That(usedRange!.RangeAddress, Is.EqualTo(ranger.RangeAddress.ToString()));\n\n\/\/ Offset: down 5 rows, right 10 columns\nvar movedRanger = sheet.Range(\n  ranger.FirstCell().CellBelow(5).CellRight(10),\n  ranger.LastCell().CellBelow(5).CellRight(10)\n);\nAssert.That(movedRanger.RangeAddress.ToString(), Is.EqualTo(\"K7:M10\"));\nmovedRanger.Value = \"Moved\";\n\n\/\/ Range has many functions:\n\/\/ Union, Intersection, Intersects, Difference\n<\/code><\/pre>\n<h2 id=\"writing-values\">Writing Values<\/h2>\n<pre><code class=\"language-c#\">using var workbook = new XLWorkbook();\nvar sheet = workbook.Worksheets.Add(\"MySheet\");\n\n\/\/ Format as text\nsheet.Cell(\"A1\").Style.NumberFormat.Format = \"@\";\n\n\/\/ Numbers\nsheet.Cell(\"B1\").Value = 15.321;\nsheet.Cell(\"B1\").Style.NumberFormat.Format = \"#,##0.00\";\nAssert.That(sheet.Cell(\"B1\").GetFormattedString(), Is.EqualTo(\"15.32\"));\nAssert.That(sheet.Cell(\"B1\").GetString(), Is.EqualTo(\"15.321\"));\n\n\/\/ Percentage\nsheet.Cell(\"C1\").Value = 0.5;\nsheet.Cell(\"C1\").Style.NumberFormat.Format = \"0%\";\nAssert.That(sheet.Cell(\"C1\").GetString(), Is.EqualTo(\"0.5\"));\nAssert.That(sheet.Cell(\"C1\").GetFormattedString(), Is.EqualTo(\"50%\"));\nAssert.That(sheet.Cell(\"C1\").Value, Is.EqualTo(0.5));\n\n\/\/ Money\nsheet.Cells(\"B2,D2\").Value = 15000.23D;\nsheet.Cells(\"C2,E2\").Value = -2000.50D;\nsheet.Range(\"B2:C2\").Style.NumberFormat.Format = \"#,##0.00 [$\u20ac-813];[Red]-#,##0.00 [$\u20ac-813]\";\nsheet.Range(\"D2:E2\").Style.NumberFormat.Format = \"[$$-409]#,##0\";\n\n\/\/ DateTime\nsheet.Cell(\"B3\").Style.NumberFormat.Format = \"yyyy-mm-dd\";\nsheet.Cell(\"B3\").FormulaA1 = $\"=DATE({DateTime.Now:yyyy,MM,dd})\";\nsheet.Cells(\"C3,D3\").Value = DateTime.Now;\nsheet.Cell(\"C3\").Style.NumberFormat.Format = DateTimeFormatInfo.CurrentInfo.FullDateTimePattern;\nsheet.Cell(\"D3\").Style.NumberFormat.Format = \"dd\/MM\/yyyy HH:mm\";\n\n\/\/ Hyperlink\nsheet.Cell(\"C24\").SetHyperlink(new XLHyperlink(\"https:\/\/itenium.be\"));\nsheet.Cell(\"C24\").Value = \"Visit us\";\n\n\/\/ Internal hyperlink\nworkbook.Worksheets.Add(\"Data\");\nsheet.Cell(\"C26\").SetHyperlink(new XLHyperlink(\"'Data'!A1\", \"(tooltip)\"));\nsheet.Cell(\"C26\").Value = \"Link to data sheet\";\n\nsheet.Cell(\"Z1\").Clear();\n<\/code><\/pre>\n<h2 id=\"styling-cells\">Styling Cells<\/h2>\n<pre><code class=\"language-c#\">using var workbook = new XLWorkbook();\nvar sheet = workbook.Worksheets.Add(\"Styling\");\n\n\/\/ Cells with style\nsheet.Cell(\"A1\").Value = \"Bold and proud\";\nsheet.Cell(\"A1\").Style.Font.FontName = \"Stencil\";\nsheet.Cell(\"A1\").Style.Font.Bold = true;\nsheet.Cell(\"A1\").Style.Font.FontColor = XLColor.Green;\n\n\/\/ Borders need to be made\nsheet.Range(\"A1:A2\").Style.Border.OutsideBorder = XLBorderStyleValues.Dotted;es.Dotted;\n\n\/\/ Merge cells\nsheet.Range(5, 5, 9, 8).Merge();\n\n\/\/ More style\nsheet.Cell(\"D14\").Style.Alignment.ShrinkToFit = true;\nsheet.Cell(\"D14\").Style.Font.FontSize = 24;\nsheet.Cell(\"D14\").Value = \"Shrinking for fit\";\n\nsheet.Cell(\"D15\").Style.Alignment.WrapText = true;\nsheet.Cell(\"D15\").Value = \"A wrap, yummy!\";\nsheet.Cell(\"D16\").Value = \"No wrap, ouch!\";\n\n\/\/ Background color\nsheet.Cell(\"B5\").Style.Fill.BackgroundColor = XLColor.Red;\n\n\/\/ Horizontal Alignment\nsheet.Cell(\"B5\").Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;\nsheet.Cell(\"B5\").Value = \"I'm centered\";\n<\/code><\/pre>\n<h3 id=\"conditional-formatting\">Conditional Formatting<\/h3>\n<p>Because a picture is worth a 1000 words:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/itenium-be.github.io\/blog-posts-new\/assets\/blog-images\/closedxml-conditional-formatting.png\" alt=\"The examples below\" \/><\/p>\n<pre><code class=\"language-c#\">sheet.Cell(\"B3\").Value = \"WhenBetween\";\nsheet\n  .Range(\"B4:B9\")\n  .AddConditionalFormat()\n  .WhenBetween(0, 20)\n  .Fill.SetBackgroundColor(XLColor.Red);\n\nsheet.Cell(\"C3\").Value = \"ColorScale\";\nsheet\n  .Range(\"C4:C9\")\n  .AddConditionalFormat()\n  .ColorScale()\n  .LowestValue(XLColor.Red)\n  .Midpoint(XLCFContentType.Percent, 50, XLColor.Yellow)\n  .HighestValue(XLColor.Green);\n\nsheet.Cell(\"D3\").Value = \"IconSet\";\nsheet\n  .Range(\"D4:D9\")\n  .AddConditionalFormat()\n  .IconSet(XLIconSetStyle.ThreeTrafficLights2)\n  .AddValue(XLCFIconSetOperator.EqualOrGreaterThan, 0, XLCFContentType.Number)\n  .AddValue(XLCFIconSetOperator.EqualOrGreaterThan, 20, XLCFContentType.Number)\n  .AddValue(XLCFIconSetOperator.EqualOrGreaterThan, 40, XLCFContentType.Number);\n\nsheet.Cell(\"E3\").Value = \"DataBar\";\nsheet\n  .Range(\"E4:E9\")\n  .AddConditionalFormat()\n  .DataBar(XLColor.Red)\n  .LowestValue()\n  .HighestValue();\n<\/code><\/pre>\n<h2 id=\"sheets\">Sheets<\/h2>\n<pre><code class=\"language-c#\">using var workbook = new XLWorkbook(\"crash-if-not-exists.xlsx\");\n\n\/\/ Has overload to add a worksheet from another workbook\nvar sheet1 = workbook.AddWorksheet(\"Sheet1\");\nsheet1.ShowGridLines = false;\nsheet1.ShowRowColHeaders = false;\n\n\/\/ While possible to password protect a sheet, it's not possible\n\/\/ to password protect an entire workbook.\nsheet1.Protect(\"password\");\n\n\/\/ Position a new worksheet\nvar sheet0 = workbook.AddWorksheet(\"Sheet0\", 0);\nsheet0.TabColor = XLColor.Redwood;\nsheet0.TabSelected = true;\nsheet0.Visibility = XLWorksheetVisibility.Hidden;\n\nsheet0.ActiveCell = sheet0.Cell(\"A5\"); \/\/ or:\nsheet0.Cell(\"A5\").SetActive();\n\/\/ Can only have one active cell but multiple can be selected\n\/\/ sheet0.Cell(\"A5\").Select();\n\n\/\/ Freezing\nsheet0.SheetView.FreezeRows(1);\nsheet0.SheetView.FreezeColumns(4);\n\nsheet0.Column(1).Hide();\n\n\/\/ Copy to same\/other workbook:\nsheet1.CopyTo(workbook, \"Copy\");\n\n\/\/ workbook.SaveAs(Stream \/ string);\n\/\/ Overload to validate &amp; evaluate formulas\n<\/code><\/pre>\n<h1 id=\"webapi\">WebApi<\/h1>\n<p>There are small nugets available for delivering the Excel in <a href=\"https:\/\/github.com\/ClosedXML\/ClosedXML?tab=readme-ov-file#extensions\">ASP.NET, MVC and WebApi<\/a> environments.<\/p>\n<p>Find the implementation for <a href=\"https:\/\/github.com\/ClosedXML\/ClosedXML.Extensions.WebApi\/blob\/master\/src\/ClosedXML.Extensions.WebApi\/WebApiExtensions.cs\">WebApi here<\/a>.<\/p>\n<pre><code class=\"language-c#\">public static class Extensions\n{\n  private const string ContentType = \"application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet\";\n\n  public static FileStreamResult Deliver(this IXLWorkbook workbook, string fileName)\n  {\n    var memoryStream = new MemoryStream();\n    workbook.SaveAs(memoryStream);\n    memoryStream.Seek(0, SeekOrigin.Begin);\n    return new FileStreamResult(memoryStream, ContentType) { FileDownloadName = fileName };\n  }\n}\n<\/code><\/pre>\n<h1 id=\"extension-methods\">Extension Methods<\/h1>\n<p>Just some handy tidbits.<\/p>\n<pre><code class=\"language-c#\">public static class ExcelExtensions\n{\n  public static IXLDataValidation SetDropdownList(this IXLCell cell, IEnumerable&lt;string&gt; options)\n  {\n    var validation = cell.CreateDataValidation();\n    validation.AllowedValues = XLAllowedValues.List;\n    validation.InCellDropdown = true;\n    validation.IgnoreBlanks = true;\n    \/\/ ATTN: must start\/end with a double quote (\")\n    validation.List($\"\"{string.Join(\",\", options)}\"\");\n    return validation;\n  }\n\n  public static IXLCell SetHyperlink(this IXLCell cell, string url, string text, string? tooltip = null)\n  {\n    cell.SetValue(text).SetHyperlink(new XLHyperlink(url, tooltip));\n    return cell;\n  }\n\n  public static IXLStyle SetNumberFormatId(this IXLNumberFormat nf, XLPredefinedFormat.Number format)\n  {\n    return nf.SetNumberFormatId((int)format);\n  }\n\n  public static IXLStyle SetNumberFormatId(this IXLNumberFormat nf, XLPredefinedFormat.DateTime format)\n  {\n    return nf.SetNumberFormatId((int)format);\n  }\n}\n<\/code><\/pre>\n<h1>Also in this series<\/h1>\n<ul>\n<li>This Part: Create Excels with C# and ClosedXML: A tutorial<\/li>\n<li>Part 2: <a href=\"\/dotnet\/create-xlsx-excel-with-closedxml-csharp-formulas-and-datavalidation\/\">Create Excels with C# and ClosedXML: Formulas &#038; DataValidation<\/a><\/li>\n<li>Part 3: <a href=\"\/dotnet\/create-xlsx-excel-with-closedxml-csharp-miscellaneous\/\">Create Excels with C# and ClosedXML: Miscellaneous<\/a><\/li>\n<li>Part 4: <a href=\"\/dotnet\/excel-formulas-cheat-sheet-closedxml\/\">Excel formulas cheat sheet<\/a><\/li>\n<\/ul>\n<h1>Extras<\/h1>\n<p><b>Stuff that came into being during the making of this post<\/b><\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/itenium-be\/ClosedXMLTutorial\">More extensive ClosedXML examples in the Github repo<\/a><\/li>\n<\/ul>\n<p><b>Other interesting reads<\/b><\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/ClosedXML\/ClosedXML.Report\">Report generation: export any data from .NET classes to Excel using an xlsx-template.<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/Itenium-Forge\/Itenium.ExcelCreator\">Our own WebApi wrapper for ClosedXML<\/a><\/li>\n<\/ul>\n<h1> Package Versions <i class=\"fa fa-info-circle\" style=\"float: right; color: cornflowerblue; font-size: 28px\" title=\"Package versions used for this post and in the accompanying code on Github\"><\/i><\/h1>\n<div><a href=\"https:\/\/github.com\/ClosedXML\/ClosedXML\" class=\"github\"><img decoding=\"async\" src=\"https:\/\/img.shields.io\/github\/stars\/ClosedXML\/ClosedXML.svg?style=social&#038;label=Star\" \/><\/a><a href=\"https:\/\/github.com\/ClosedXML\/ClosedXML\">ClosedXML\/ClosedXML<\/a>: v0.105.0 <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Quick tutorial about creating xlsx Excels with C# and the <a href=\"https:\/\/github.com\/ClosedXML\/ClosedXML\">ClosedXML nuget package<\/a>.<\/p>\n<p>The blog posts only covers the most important functionality. <a href=\"https:\/\/github.com\/itenium-be\/ClosedXMLTutorial\">More extensive code examples<\/a> can be found in the GitHub project.<\/p>\n","protected":false},"author":1,"featured_media":1945,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[11],"tags":[12,6],"class_list":["post-1319","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","tag-excel","tag-tutorial"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Create Excels with C# and ClosedXML: A tutorial - Itenium<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create Excels with C# and ClosedXML: A tutorial - Itenium\" \/>\n<meta property=\"og:description\" content=\"Quick tutorial about creating xlsx Excels with C# and the ClosedXML nuget package.The blog posts only covers the most important functionality. More extensive code examples can be found in the GitHub project.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/\" \/>\n<meta property=\"og:site_name\" content=\"Itenium\" \/>\n<meta property=\"article:published_time\" content=\"2025-09-28T22:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-28T12:31:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/closedxml.png\" \/>\n\t<meta property=\"og:image:width\" content=\"360\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Usdevelop\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Usdevelop\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/\",\"url\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/\",\"name\":\"Create Excels with C# and ClosedXML: A tutorial - Itenium\",\"isPartOf\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/closedxml.png\",\"datePublished\":\"2025-09-28T22:00:00+00:00\",\"dateModified\":\"2025-11-28T12:31:40+00:00\",\"author\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022\"},\"breadcrumb\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/#primaryimage\",\"url\":\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/closedxml.png\",\"contentUrl\":\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/closedxml.png\",\"width\":360,\"height\":300,\"caption\":\"computer graveyard, cracked tombstone engraved EPPlus, beside it a shining crystal monument glowing with the word ClosedXML, surreal digital illustration, moody atmosphere, high detail\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/demo.sidekick.be\/itenium\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create Excels with C# and ClosedXML: A tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#website\",\"url\":\"https:\/\/demo.sidekick.be\/itenium\/\",\"name\":\"Itenium\",\"description\":\"We build software. We build careers.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/demo.sidekick.be\/itenium\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022\",\"name\":\"Usdevelop\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g\",\"caption\":\"Usdevelop\"},\"sameAs\":[\"https:\/\/demo.sidekick.be\/itenium\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create Excels with C# and ClosedXML: A tutorial - Itenium","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Create Excels with C# and ClosedXML: A tutorial - Itenium","og_description":"Quick tutorial about creating xlsx Excels with C# and the ClosedXML nuget package.The blog posts only covers the most important functionality. More extensive code examples can be found in the GitHub project.","og_url":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/","og_site_name":"Itenium","article_published_time":"2025-09-28T22:00:00+00:00","article_modified_time":"2025-11-28T12:31:40+00:00","og_image":[{"width":360,"height":300,"url":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/closedxml.png","type":"image\/png"}],"author":"Usdevelop","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Usdevelop","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/","url":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/","name":"Create Excels with C# and ClosedXML: A tutorial - Itenium","isPartOf":{"@id":"https:\/\/demo.sidekick.be\/itenium\/#website"},"primaryImageOfPage":{"@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/#primaryimage"},"image":{"@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/#primaryimage"},"thumbnailUrl":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/closedxml.png","datePublished":"2025-09-28T22:00:00+00:00","dateModified":"2025-11-28T12:31:40+00:00","author":{"@id":"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022"},"breadcrumb":{"@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/#primaryimage","url":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/closedxml.png","contentUrl":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/closedxml.png","width":360,"height":300,"caption":"computer graveyard, cracked tombstone engraved EPPlus, beside it a shining crystal monument glowing with the word ClosedXML, surreal digital illustration, moody atmosphere, high detail"},{"@type":"BreadcrumbList","@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/create-xlsx-excel-with-closedxml-csharp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/demo.sidekick.be\/itenium\/"},{"@type":"ListItem","position":2,"name":"Create Excels with C# and ClosedXML: A tutorial"}]},{"@type":"WebSite","@id":"https:\/\/demo.sidekick.be\/itenium\/#website","url":"https:\/\/demo.sidekick.be\/itenium\/","name":"Itenium","description":"We build software. We build careers.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/demo.sidekick.be\/itenium\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022","name":"Usdevelop","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g","caption":"Usdevelop"},"sameAs":["https:\/\/demo.sidekick.be\/itenium"]}]}},"_links":{"self":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts\/1319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/comments?post=1319"}],"version-history":[{"count":2,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts\/1319\/revisions"}],"predecessor-version":[{"id":2137,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts\/1319\/revisions\/2137"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/media\/1945"}],"wp:attachment":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/media?parent=1319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/categories?post=1319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/tags?post=1319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}