ExcelAssistant 1.8.3

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

ExcelAssistant

ExcelAssistant is a lightweight and efficient .NET library designed to simplify working with Microsoft Excel files. It allows developers to easily read, write, and manipulate Excel workbooks and worksheets directly within their .NET applications.

Features

  • Read data from Excel files
  • Write data to Excel files
  • Manipulate worksheets: add, delete, rename, set tab colors
  • Customize cells: set values, formats, column widths, and row heights
  • Apply styles to cells and worksheets

Installation

You can install ExcelAssistant using NuGet:

Install-Package ExcelAssistant

.NET CLI Console

dotnet add package ExcelAssistant

Getting Started

Writing a Excel File

The following example demonstrates how to create an Excel file with multiple worksheets and custom headers:

using ExcelAssistant;

// Sample data
var reports = new List<Report>()
{
    new("Maki", "test@gmail.com", 100),
    new("Smith", "test1@gmail.com", 200),
    new("Lara", "test2@gmail.com", 450),
};

var customers = new List<Customer>()
{
    new("Alice", "alice@mail.com"),
    new("Bob", "bob@mail.com"),
    new("Charlie", "charlie@mail.com"),
};

using var writer = new ExcelWriter();

// Define column mappings
writer.AddMapping<Report>(r => r.Name, "Customer Name");
writer.AddMapping<Report>(r => r.Balance, "Account Balance");
writer.AddMapping<Customer>(c => c.Email, "Email Address");

// Exclude a field using typed method or just providing name as string
writer.Exclude<Customer>(r => r.Id);
writer.Exclude("Id"); 

// Build multiple sheets
writer.BuildSheet(reports, "Reports");
writer.BuildSheet(customers, "Customers");

// Save the Excel file
using var stream = File.OpenWrite("records.xlsx");
writer.CopyTo(stream);


// Example models
public record Report(string Name, string Email, decimal Balance);
public record Customer(string Name, string Email);

Reading from an Excel File

You can also read data back into C# models. Column headers in the Excel file must match the defined mappings.

using var stream = File.OpenRead("records.xlsx");
using var reader = new ExcelReader(stream);

reader.AddMapping<Report>(r => r.Name, "Customer Name");
reader.AddMapping<Report>(r => r.Balance, "Account Balance");
reader.AddMapping<Customer>(c => c.Email, "Email Address");

// if sheet nane is not set it will read firs sheet
var reportRecords = reader.Read<Report>();
var customerRecords = reader.Read<Customer>("Customers");

License

ExcelAssistant is released under the MIT License.

Product Compatible and additional computed target framework versions.
.NET 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. 
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.8.3 159 11/14/2025
1.8.2 175 10/15/2025
1.8.1 290 9/30/2025
1.8.0 225 8/14/2025
1.7.0 181 8/14/2025
1.6.3 599 4/11/2025
1.6.2 498 12/17/2024
1.6.1 154 12/17/2024
1.6.0 151 12/17/2024
1.5.4 556 8/16/2024
1.5.3 249 7/16/2024
1.5.2 166 7/16/2024
1.5.1 184 7/2/2024
1.5.0 161 7/2/2024
1.4.0 167 6/27/2024
1.3.6 229 6/3/2024
1.3.5 169 6/3/2024
1.3.3 342 1/19/2024
1.3.2 162 1/19/2024
1.3.1 192 1/19/2024
1.3.0 353 11/16/2023
1.2.4 365 8/11/2023
1.2.3 291 7/18/2023
1.2.2 249 7/17/2023
1.2.0 280 5/4/2023
1.1.2 248 5/4/2023
1.1.1 285 5/1/2023
1.1.0 275 5/1/2023
1.0.0 288 4/28/2023