Top Related Projects
ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files. It aims to provide an intuitive and user-friendly interface to dealing with the underlying OpenXML API.
Create advanced Excel spreadsheets using .NET
Lightweight and fast library written in C# for reading Microsoft Excel files
Quick Overview
EPPlus is a .NET Standard library that allows developers to create, read, and manipulate Microsoft Excel files (XLSX) without the need for Microsoft Office Automation. It provides a comprehensive set of features for working with spreadsheets, including creating, formatting, and manipulating worksheets, cells, and formulas.
Pros
- Cross-Platform Compatibility: EPPlus is a .NET Standard library, which means it can be used on a variety of platforms, including Windows, macOS, and Linux.
- Comprehensive Functionality: EPPlus offers a wide range of features for working with Excel files, including support for formulas, charts, images, and more.
- Performance: EPPlus is designed to be efficient and fast, with optimized algorithms for common operations.
- Open-Source: EPPlus is an open-source project, which means it is freely available and can be customized and extended as needed.
Cons
- Limited Compatibility with Older Excel Versions: EPPlus is primarily focused on the XLSX format, which was introduced in Excel 2007. It may have limited support for older Excel file formats, such as XLS.
- Dependency on .NET Standard: Since EPPlus is a .NET Standard library, it requires a .NET Standard-compatible runtime environment, which may not be available on all platforms.
- Complexity: While EPPlus provides a comprehensive set of features, the API can be complex and may have a steep learning curve for some developers.
- Potential Performance Issues with Large Files: While EPPlus is generally fast, working with very large Excel files may result in performance issues.
Code Examples
Here are a few examples of how to use EPPlus:
- Creating a New Excel File:
using (var package = new ExcelPackage())
{
var worksheet = package.Workbook.Worksheets.Add("My Worksheet");
worksheet.Cells["A1"].Value = "Hello, EPPlus!";
package.SaveAs(new FileInfo("output.xlsx"));
}
- Formatting Cells:
using (var package = new ExcelPackage(new FileInfo("input.xlsx")))
{
var worksheet = package.Workbook.Worksheets[0];
worksheet.Cells["A1:B3"].Style.Font.Bold = true;
worksheet.Cells["A1:B3"].Style.Font.Color.SetColor(System.Drawing.Color.Red);
package.SaveAs(new FileInfo("output.xlsx"));
}
- Working with Formulas:
using (var package = new ExcelPackage(new FileInfo("input.xlsx")))
{
var worksheet = package.Workbook.Worksheets[0];
worksheet.Cells["A1"].Value = 10;
worksheet.Cells["A2"].Value = 20;
worksheet.Cells["A3"].Formula = "=A1+A2";
package.SaveAs(new FileInfo("output.xlsx"));
}
- Generating Charts:
using (var package = new ExcelPackage(new FileInfo("input.xlsx")))
{
var worksheet = package.Workbook.Worksheets[0];
var chart = worksheet.Drawings.AddChart("MyChart", eChartType.ColumnClustered);
chart.Series.Add(worksheet.Cells["A1:A5"], worksheet.Cells["B1:B5"]);
package.SaveAs(new FileInfo("output.xlsx"));
}
Getting Started
To get started with EPPlus, you can install the NuGet package in your .NET project:
Install-Package EPPlus
Once you have the package installed, you can start using EPPlus in your code. Here's a simple example of how to create a new Excel file and write some data to it:
using (var package = new ExcelPackage())
{
var worksheet = package.Workbook.Worksheets.Add("My Worksheet");
worksheet.Cells["A1"].Value = "Name";
worksheet.Cells["B1"].Value =
Competitor Comparisons
ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files. It aims to provide an intuitive and user-friendly interface to dealing with the underlying OpenXML API.
Pros of ClosedXML/ClosedXML
- Simplicity: ClosedXML provides a more straightforward and user-friendly API compared to EPPlus, making it easier for developers to work with.
- Performance: ClosedXML is generally faster and more efficient than EPPlus, especially when working with large Excel files.
- Open-Source: ClosedXML is an open-source project, allowing for community contributions and a more transparent development process.
Cons of ClosedXML/ClosedXML
- Limited Functionality: ClosedXML has a more limited set of features compared to EPPlus, which offers a wider range of functionality for working with Excel files.
- Fewer Supported Formats: ClosedXML primarily focuses on the XLSX format, while EPPlus supports a broader range of Excel file formats, including the older XLS format.
- Fewer Customization Options: ClosedXML may not provide as many customization options as EPPlus, which offers more flexibility in terms of styling and formatting.
Code Comparison
Here's a brief code comparison for creating a simple Excel file using both EPPlus and ClosedXML:
EPPlusSoftware/EPPlus:
using (var package = new ExcelPackage())
{
var worksheet = package.Workbook.Worksheets.Add("Sheet1");
worksheet.Cells["A1"].Value = "Hello, World!";
package.SaveAs(new FileInfo("example.xlsx"));
}
ClosedXML/ClosedXML:
using (var workbook = new XLWorkbook())
{
var worksheet = workbook.AddWorksheet("Sheet1");
worksheet.Cell("A1").Value = "Hello, World!";
workbook.SaveAs("example.xlsx");
}
As you can see, both libraries provide a similar API for creating and saving Excel files, but ClosedXML's syntax is slightly more concise and straightforward.
Create advanced Excel spreadsheets using .NET
Pros of EPPlus
- Actively maintained and regularly updated by the EPPlusSoftware team
- Supports a wide range of Excel features and functionality
- Provides a well-documented and easy-to-use API
Cons of EPPlus
- Requires a commercial license for commercial use
- May have a steeper learning curve compared to some other Excel libraries
Code Comparison
EPPlusSoftware/EPPlus
using (var package = new ExcelPackage())
{
var worksheet = package.Workbook.Worksheets.Add("Sheet1");
worksheet.Cells["A1"].Value = "Hello, World!";
package.Save("output.xlsx");
}
JanKallman/EPPlus
using (var package = new ExcelPackage())
{
var worksheet = package.Workbook.Worksheets.Add("Sheet1");
worksheet.Cells["A1"].Value = "Hello, World!";
package.SaveAs(new FileInfo("output.xlsx"));
}
The main difference in the code is the way the file is saved. In the EPPlusSoftware/EPPlus version, the package.Save()
method is used, while in the JanKallman/EPPlus version, the package.SaveAs()
method is used with a FileInfo
object.
Lightweight and fast library written in C# for reading Microsoft Excel files
Pros of ExcelDataReader/ExcelDataReader
- Simplicity: ExcelDataReader provides a straightforward and lightweight API for reading Excel files, making it a good choice for simple use cases.
- Cross-platform: ExcelDataReader is a .NET Standard library, allowing it to be used on a variety of platforms, including Windows, macOS, and Linux.
- Performance: ExcelDataReader is generally faster than EPPlus for reading large Excel files, as it uses a more efficient streaming-based approach.
Cons of ExcelDataReader/ExcelDataReader
- Limited Functionality: ExcelDataReader is primarily focused on reading Excel files and lacks the extensive feature set of EPPlus, which includes the ability to create, modify, and write Excel files.
- No Write Support: ExcelDataReader does not provide any functionality for writing or modifying Excel files, which may be a limitation for some use cases.
- Fewer Customization Options: EPPlus offers more customization options and control over the Excel file format, which may be important for more complex use cases.
Code Comparison
EPPlus:
using (var package = new ExcelPackage(new FileInfo("example.xlsx")))
{
var worksheet = package.Workbook.Worksheets[0];
var value = worksheet.Cells[1, 1].Value;
Console.WriteLine(value);
}
ExcelDataReader:
using (var stream = File.Open("example.xlsx", FileMode.Open, FileAccess.Read))
{
using (var reader = ExcelReaderFactory.CreateReader(stream))
{
var dataSet = reader.AsDataSet();
var value = dataSet.Tables[0].Rows[0][0];
Console.WriteLine(value);
}
}
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
EPPlus 8
License
EPPlus 8 has a dual license model with a community license for noncommercial use: Polyform Noncommercial 1.0.0.
With this license EPPlus is free to use for personal/noncommercial use, but will require a commercial license to be used in a commercial business.
Commercial licenses, which includes support, can be purchased at (https://www.epplussoftware.com/). For more details on our licensing, see our License FAQ.
The source code for EPPlus is available at EPPlus Software's github repository
License parameter must be set
Before using EPPlus 8, you must specify the license to use. This is done via the static License property of the ExcelPackage class
For commercial use, set the ExcelPackage.License.SetCommercial(string), with your license key as argument. Your license key is available on your license, under the section "My Licenses" on our website and on EPPLus license documents created after February 2025.
For noncommercial use, set the ExcelPackage.License.SetNonCommercialOrganization(string) or ExcelPackage.License.SetNonCommercialPersonal(string) with your name as argument. When configured for noncommercial use, EPPlus will reserve the Comment and Tag field of the package for license information and add a license file within the package.
You can also configure these settings in the configuration files or in an environment varialble:
1. Via code
// If you are a commercial business and have purchased a commercial license:
ExcelPackage.License.SetCommercial("<Your License Key here>");
// If you use EPPlus in a noncommercial context according to the Polyform Noncommercial license:
ExcelPackage.License.SetNonCommercialPersonal("<Your Name>");
// or...
ExcelPackage.License.SetNonCommercialOrganization("<Your Noncommercial Organization>");
using(var package = new ExcelPackage(new FileInfo("MyWorkbook.xlsx")))
{
}
2. Via appSettings.json
For commercial use:
{
"EPPlus": {
"ExcelPackage": {
"License": "Commercial:<Your License Key here>"
}
}
}
For noncommercial use:
{
"EPPlus": {
"ExcelPackage": {
"License": "NonCommercialPersonal:<Your Name>" //..or use "NonCommercialOrganization:<Your organizations name>"
}
}
}
3. Via app/web.config
For commercial use:
<appSettings>
<!--The license context used-->
<add key="EPPlus:ExcelPackage.License" value="Commercial:<Your License Key here>" />
</appSettings>
For noncommercial use:
<appSettings>
<!--The license context used-->
<add key="EPPlus:ExcelPackage.License" value="NonCommercialPersonal:<Your Name>" /> <!--..or use "NonCommercialOrganization:Your organizations name" -->
</appSettings>
4. Set the environment variable 'EPPlusLicense'
This might be the easiest way of configuring this.
Set the variable to Commercial:<Your License Key>
, NonCommercialPersonal:<Your Name>
or NonCommercialOrganization:<Your organizations name>
The example below set the license key using the SETX command in the Windows console on the user level, but you can set it in any way you prefer.
> SETX EPPlusLicense "Commercial:<Your License Key>"
New features in EPPlus 8
See https://epplussoftware.com/en/Developers/EPPlus8
Breaking Changes
See https://github.com/EPPlusSoftware/EPPlus/wiki/Breaking-Changes-in-EPPlus-8
Top Related Projects
ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files. It aims to provide an intuitive and user-friendly interface to dealing with the underlying OpenXML API.
Create advanced Excel spreadsheets using .NET
Lightweight and fast library written in C# for reading Microsoft Excel files
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot