Please don't ask questions on the comments section of the documentation pages because Codeplex doesn't send notifications for them. Please use the discussion tab instead. Thanks.


To use ClosedXML you must reference the DocumentFormat.OpenXml.dll:

DocumentFormat.OpenXml.dll for NET 4.0+

DocumentFormat.OpenXml.dll for NET 3.5



How do I deliver an Excel file in ASP.NET?
Does it support Excel 2003 and prior formats (.xls)?
How can I insert an image?
Text with numbers are getting converted to numbers, what's up with that?
How do I get the result of a formula?


Showcase - No nonsense example of how to use this API
Basic Table
Hello World - Proverbial hello world program

Real world scenarios

Finding and extracting the data

Time Savers

Simplifying your life...

Performance and Memory

Turning off events
Better lambdas
Where to use the using keyword
Other performance improvements


Data Types - How to handle and convert cell's data types (Text, Boolean, DateTime, Numeric)
Creating Multiple Worksheets
Organizing Sheets
Loading and Modifying Files
Using Lambda Expressions
Cell Values
Workbook Properties
Using Formulas
Evaluating Formulas - New
Creating Rows/Columns Outlines
Hide Unhide Row(s)/Column(s)
Freeze Panes
Copying Worksheets
Using Hyperlinks
Data Validation
Hide Worksheets
Sheet Protection
Tab Colors
Conditional Formatting
Pivot Table example

Inserting Data/Tables

Copying IEnumerable Collections - Using "cell.Value = collection"
Inserting Data - Using "cell.InsertData(collection)"
Inserting Tables - Using "cell.InsertTable(collection)"
Adding DataTable as Worksheet
Adding DataSet


Styles - Alignment
Styles - Border
Styles - Fill
Styles - Font
Styles - NumberFormat
NumberFormatId Lookup Table
Style Worksheet
Style Rows and Columns
Using Default Styles
Using Colors
ClosedXML Predefined Colors
Excel Indexed Colors
Using Rich Text
Using Phonetics


Defining Ranges
Merging Cells
Clearing Ranges
Deleting Ranges
Multiple Ranges
Shifting Ranges
Transpose Ranges
Named Ranges
Accessing Named Ranges - New
Copying Ranges
Using Tables
Sorting Data
Selecting Cells and Ranges


Row Height and Styles
Selecting Rows
Inserting Rows
Inserting and Deleting Rows
Adjust Row Height and Column Width to Contents
Row Cells


Column Width and Styles
Selecting Columns
Inserting Columns
Inserting and Deleting Columns
Adjust Row Height and Column Width to Contents
Column Cells

Page Setup (Print Options)

Pages Tab
Paper Size Lookup Table
Margins Tab
Headers and Footers Tab
Sheet Tab
Print Areas and Page Breaks


Adding an AutoFilter to a Range
Filter Values
Custom Filters


Style - Alignment
Style - Colors and Lines
Style - Size
Style - Protection
Style - Properties
Style - Margins
Style - Web

Last edited Jun 4, 2014 at 7:57 PM by MDeLeon, version 134


kutekrish Aug 18 at 9:38 AM 
Amazing utility, thanks for your effort !!!

mlaos May 6 at 3:57 PM 
I need Help with this.
In office interop, I use:
((Range)excelWorksheet.Rows[RowIndex + 1]).Select();
((Range)excelWorksheet.Rows[RowIndex + 1]).Insert(XlInsertShiftDirection.xlShiftToRight, XlInsertFormatOrigin.xlFormatFromLeftOrAbove);

But in ClosedXML I do not how to used.
I use:
excelWorksheet.Row(RowIndex + 1).Select();
excelWorksheet.Row(RowIndex + 1).InsertRowsBelow(1);

But in the excel the Data do not respect the position. My excel have a Graph but this superposstion in the data.

Anyone can help me
Michel Laos

punkologist Nov 24, 2014 at 4:24 AM 
This is brilliant! If we had something like this for word docs a couple of years ago the project I was one would have been cut in half!

kevwhitt Oct 29, 2014 at 10:47 AM 
Dim wb = New XLWorkbook

Absolutely brilliant! The best two lines of code I've ever used!

cooper360 Jun 5, 2014 at 3:00 AM 
Merge branch 'master' of

I found this page 404 not found.(404 - File or directory not found)

eldhoabe Apr 8, 2014 at 12:13 PM 
Great work , nicely documented.

benjcev Feb 6, 2014 at 9:15 AM 
it's amazing!!! great library.


jeffersonpereira Oct 28, 2013 at 6:19 PM 
Good Job! Thanks you colaboration!!!
Yeah, Time Savers and simplifying my life...


john_kidd Oct 4, 2013 at 2:39 PM 
Best OpenXML library available - awesome

erik00010 Oct 1, 2013 at 9:59 AM 
Absolutely made my day!

lushgreen Jul 21, 2013 at 5:42 AM 
You are Fabulous!

fady1956 Nov 14, 2012 at 5:32 AM 
what happened to this wonderfull project? are you guys still developping new features? chrting is a badly needed feature!

WindowsDeveloper Oct 20, 2012 at 7:10 AM 
The best ever tool for the job! It helped same me a lot of time. Thanks!

Nikoli99 Sep 28, 2012 at 11:51 PM 
This is awesome! Thank you very much for creating this. Exactly what I needed without having to dive into all the XML.

croutman Apr 30, 2012 at 3:39 PM 
I tried for a full week to get openXML to work. When I did get it to work it was extremly slow. Not sure what I was doing wrong.. This library saved me. GREAT Job.

syedatifimtiaz Apr 17, 2012 at 4:06 PM 
can we add chart using this library ?

LuisJuarez Jan 26, 2012 at 3:45 PM 
I am very impressed with this project, creating an API is always brilliant, this is a great project. Thanks for sharing this with us, much appreciated

CastleSoft Jan 12, 2012 at 12:17 AM 
Amazing Library.. A MUST have for any .NET developer.

Any chance of the docs above being placed into a DOCX or PDF file for simple downloading/printing ?

Jimboguy Dec 13, 2011 at 4:45 PM 
How can I print the document programmatically.

nouris Dec 10, 2011 at 6:45 PM 
This is a great library that I am finding very useful for my projects. Thanks for the great work!

fraguada Aug 18, 2011 at 9:18 PM 
Wanted to mention that this is a great resource! I was up and running with exactly what I wanted to do in mere minutes. Many nice methods included which make it super intuitive for a beginner such as me. Thank you very much!

bibobb Apr 21, 2011 at 4:20 AM 
Amazing piece of work. This project looks very promising. Highly recommended for those who want to avoid the complexities of messing around with OpenXML SDK.

enmanuelr Mar 4, 2011 at 6:34 AM 
After bashing my head against the OpenXML API for way too long, I stumbled on this gem. GREAT API! Very clean, easy to code against. Very clear and concise. I really appreciate you took the time to make this and make it available under a permissive license. Great stuff!

olafjiri Sep 12, 2010 at 2:45 PM 
ClosedXML allows VBA people to write OpemXML applications without learning OpenXML. I think ClosedXML has tremendous potential. I tried real scenario and it works. Parsed 1200 page text report from mainframe and put each page (cost centre) into separate worksheet. Takes about 10 seconds for the lot. If user would want only few outlets it is very fast.

olafjiri Sep 3, 2010 at 9:07 AM 
Great name, fantastic product! This is how I was imagining OpenXML in Visual Studio. Amazing productivity in coding OpenXML. Thanks for the vision and determination.