Linger.Excel.ClosedXML 1.4.2

dotnet add package Linger.Excel.ClosedXML --version 1.4.2
                    
NuGet\Install-Package Linger.Excel.ClosedXML -Version 1.4.2
                    
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.2" />
                    
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.2" />
                    
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.2
                    
#r "nuget: Linger.Excel.ClosedXML, 1.4.2"
                    
#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.2
                    
#: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.2
                    
Install as a Cake Addin
#tool nuget:?package=Linger.Excel.ClosedXML&version=1.4.2
                    
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.2 92 5/20/2026
1.4.1-preview 92 5/12/2026
1.4.0 99 5/6/2026
1.3.3-preview 85 5/5/2026
1.3.2-preview 92 4/29/2026
1.3.1-preview 89 4/28/2026
1.3.0-preview 89 4/27/2026
1.2.0-preview 105 3/29/2026
1.1.0 117 2/4/2026
1.0.3-preview 112 1/9/2026
1.0.2-preview 114 1/8/2026
1.0.0 318 11/12/2025
1.0.0-preview2 208 11/6/2025
1.0.0-preview1 225 11/5/2025
0.9.9 216 10/16/2025
0.9.8 204 10/14/2025
0.9.7-preview 219 10/13/2025
0.9.6-preview 185 10/12/2025
0.9.5 191 9/28/2025
0.9.4-preview 198 9/25/2025
Loading failed