Linger.Excel.ClosedXML 1.4.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Linger.Excel.ClosedXML --version 1.4.0
                    
NuGet\Install-Package Linger.Excel.ClosedXML -Version 1.4.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Linger.Excel.ClosedXML" Version="1.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Linger.Excel.ClosedXML" Version="1.4.0" />
                    
Directory.Packages.props
<PackageReference Include="Linger.Excel.ClosedXML" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Linger.Excel.ClosedXML --version 1.4.0
                    
#r "nuget: Linger.Excel.ClosedXML, 1.4.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Linger.Excel.ClosedXML@1.4.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Linger.Excel.ClosedXML&version=1.4.0
                    
Install as a Cake Addin
#tool nuget:?package=Linger.Excel.ClosedXML&version=1.4.0
                    
Install as a Cake Tool

Linger.Excel.ClosedXML

Overview

Linger.Excel.ClosedXML is an implementation of the Excel manipulation interfaces defined in Linger.Excel.Contracts, based on the powerful ClosedXML library. This package provides high-performance Excel file operations with a clean, abstracted API.

Features

  • Read and write Excel files (.xlsx format) with a simple, intuitive API
  • Convert Excel data to strongly-typed object collections and vice versa
  • Data table import and export capabilities
  • Template-based Excel generation
  • Advanced styling and formatting options
  • Cell formula support
  • Multi-worksheet management
  • Comprehensive error handling

Installation

dotnet add package Linger.Excel.ClosedXML

Usage

Basic Setup

// Register in DI container
services.AddExcelClosedXML(options => 
{
    options.DefaultDateFormat = "yyyy-MM-dd";
    options.AutoFitColumns = true;
});

// Or create an instance directly
var excel = new ClosedXmlExcel(new ExcelOptions 
{
    DefaultDateFormat = "yyyy-MM-dd",
    AutoFitColumns = true  
});

Reading Excel Files

// Convert Excel to List<T>
var users = excel.ExcelToList<UserModel>("users.xlsx");

// Convert Excel to DataTable
var dataTable = excel.ExcelToDataTable("data.xlsx", sheetName: "Sheet1");

// Read from stream
using var stream = File.OpenRead("data.xlsx");
var results = excel.ExcelToList<ResultModel>(stream);

Writing Excel Files

// Convert List<T> to Excel file
var users = GetUsers(); // Your data source
excel.ListToExcel(users, "users.xlsx");

// Convert DataTable to Excel file
var dataTable = GetDataTable(); // Your data source
excel.DataTableToExcel(dataTable, "data.xlsx");

// Export to stream (for web downloads, etc.)
using var memoryStream = new MemoryStream();
excel.ListToExcel(products, memoryStream);
return File(memoryStream.ToArray(), 
    "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", 
    "products.xlsx");

Advanced Features

// Multi-sheet operations
var workbook = excel.CreateWorkbook();
excel.AddSheet(workbook, "Users", users);
excel.AddSheet(workbook, "Products", products);
excel.SaveWorkbook(workbook, "company_data.xlsx");

// Styling
excel.ListToExcel(salesData, "sales_report.xlsx", styleOptions => 
{
    styleOptions.HeaderBackgroundColor = "#1E90FF";
    styleOptions.HeaderFontColor = "#FFFFFF";
    styleOptions.AlternatingRowBackgroundColor = "#F0F8FF";
});

Dependencies

  • ClosedXML (v0.105.0+)
  • Linger.Excel.Contracts

Target Frameworks

  • .NET Standard 2.0+
  • .NET 8.0+
  • .NET 9.0+
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.4.1-preview 35 5/12/2026
1.4.0 94 5/6/2026
1.3.3-preview 80 5/5/2026
1.3.2-preview 88 4/29/2026
1.3.1-preview 86 4/28/2026
1.3.0-preview 87 4/27/2026
1.2.0-preview 102 3/29/2026
1.1.0 115 2/4/2026
1.0.3-preview 108 1/9/2026
1.0.2-preview 109 1/8/2026
1.0.0 316 11/12/2025
1.0.0-preview2 205 11/6/2025
1.0.0-preview1 222 11/5/2025
0.9.9 212 10/16/2025
0.9.8 199 10/14/2025
0.9.7-preview 216 10/13/2025
0.9.6-preview 181 10/12/2025
0.9.5 188 9/28/2025
0.9.4-preview 194 9/25/2025
0.9.3-preview 232 9/22/2025
Loading failed