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.

Requirements:

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

DocumentFormat.OpenXml.dll for NET 4.0+

DocumentFormat.OpenXml.dll for NET 3.5

 

FAQ

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?

Examples

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

Misc

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

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

Ranges

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

Rows

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

Columns

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

AutoFilters

Adding an AutoFilter to a Range
Filter Values
Custom Filters

Comments

Visibility
Position
Signatures
Style - Alignment
Style - Colors and Lines
Style - Size
Style - Protection
Style - Properties
Style - Margins
Style - Web

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

Comments

kevwhitt Oct 29 at 9:47 AM 
Dim wb = New XLWorkbook
wb.Worksheets.Add(dataSet)

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

cooper360 Jun 5 at 2:00 AM 
b9ef53a6654f
Merge branch 'master' of https://git01.codeplex.com/forks/vbjay/closedxml

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

eldhoabe Apr 8 at 11:13 AM 
Great work , nicely documented.

benjcev Feb 6 at 8:15 AM 
it's amazing!!! great library.

muhteşem.

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

Thanks.

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

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

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

fady1956 Nov 14, 2012 at 4: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 6:10 AM 
The best ever tool for the job! It helped same me a lot of time. Thanks!

Nikoli99 Sep 28, 2012 at 10: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 2: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 3:06 PM 
can we add chart using this library ?

LuisJuarez Jan 26, 2012 at 2: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 11, 2012 at 11:17 PM 
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 3:45 PM 
How can I print the document programmatically.

nouris Dec 10, 2011 at 5: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 8: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 3: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 5: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 1: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.
Regards
Olaf

olafjiri Sep 3, 2010 at 8: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.
Regards
Olaf