Soenneker.Excel.Util 11.0.383

Prefix Reserved
dotnet add package Soenneker.Excel.Util --version 11.0.383
                    
NuGet\Install-Package Soenneker.Excel.Util -Version 11.0.383
                    
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="Soenneker.Excel.Util" Version="11.0.383" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Excel.Util" Version="11.0.383" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Excel.Util" />
                    
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 Soenneker.Excel.Util --version 11.0.383
                    
#r "nuget: Soenneker.Excel.Util, 11.0.383"
                    
#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 Soenneker.Excel.Util@11.0.383
                    
#: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=Soenneker.Excel.Util&version=11.0.383
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Excel.Util&version=11.0.383
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Excel.Util

Maps rows in an .xlsx worksheet to strongly typed objects and writes object lists to a new workbook using ClosedXML.

Install

dotnet add package Soenneker.Excel.Util

Define a row type

using Soenneker.Excel.Util.Attributes;

public sealed class Person
{
    public string Name { get; set; } = "";
    public int Age { get; set; }

    [ExcelColumn("Email Address")]
    public string Email { get; set; } = "";
}

Public instance properties must have public getters and setters and cannot be indexers. By default the header must exactly match the property name. ExcelColumnAttribute supplies a different exact header.

Register and use

using Microsoft.Extensions.DependencyInjection;
using Soenneker.Excel.Util.Abstract;
using Soenneker.Excel.Util.Registrars;

var services = new ServiceCollection();
services.AddLogging();
services.AddExcelUtilAsSingleton();

using ServiceProvider provider = services.BuildServiceProvider();
IExcelUtil excel = provider.GetRequiredService<IExcelUtil>();

var people = new List<Person>
{
    new() { Name = "Alice", Age = 30, Email = "alice@example.com" },
    new() { Name = "Bob", Age = 25, Email = "bob@example.com" }
};

excel.Write(people, @"C:\exports\people.xlsx", "People");

List<Person> imported = excel.Read<Person>(@"C:\exports\people.xlsx", "People");

AddExcelUtilAsSingleton() and AddExcelUtilAsScoped() register the same stateless utility with different DI lifetimes. Each operation creates and disposes its own workbook; no workbook or file handle is retained by the service.

Mapping behavior

  • The first used row is treated as the header row. Each subsequent used row creates one T.
  • Header matching is ordinal and case-sensitive. Extra columns are ignored; a missing mapped column or blank cell leaves the property's constructor/default value unchanged.
  • Duplicate worksheet headers resolve to the first matching column.
  • Writing uses the mapped public properties as columns and calls ToString() for non-null values, so cells are written as text. Reading gets cell values as text and applies the package's basic property conversion.
  • An empty worksheet returns an empty list. A missing file or worksheet, an unreadable workbook, or a failed type conversion is reported by the underlying API.

Write creates a new workbook containing the requested sheet and overwrites the destination path; it does not append to or preserve an existing workbook, formatting, formulas, or other sheets. Ensure the parent directory exists and use a temporary file plus an atomic replace when a partially written destination is unacceptable.

Both APIs are synchronous and ClosedXML loads workbook data in memory. Apply file-size and decompression limits before accepting untrusted uploads, and avoid using this utility for very large streaming imports or exports.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
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
11.0.383 208 11/18/2026
11.0.380 93 11/18/2026
11.0.378 88 11/18/2026
11.0.377 114 11/15/2026
11.0.376 159 11/11/2026
11.0.375 90 11/11/2026
11.0.373 112 11/11/2026
11.0.372 87 11/11/2026
11.0.371 91 11/11/2026
11.0.370 90 11/11/2026
11.0.369 98 11/11/2026
11.0.368 230 11/3/2026
11.0.367 105 11/3/2026
11.0.366 104 11/2/2026
11.0.365 143 10/27/2026
11.0.364 111 10/26/2026
11.0.363 106 10/26/2026
11.0.362 102 10/26/2026
4.0.361 528 10/15/2026
4.0.360 115 10/14/2026
Loading failed

Update dependency Soenneker.Extensions.Type to 11.0.728 (#980)