ExcelAssistant 1.3.3
See the version list below for details.
dotnet add package ExcelAssistant --version 1.3.3
NuGet\Install-Package ExcelAssistant -Version 1.3.3
<PackageReference Include="ExcelAssistant" Version="1.3.3" />
<PackageVersion Include="ExcelAssistant" Version="1.3.3" />
<PackageReference Include="ExcelAssistant" />
paket add ExcelAssistant --version 1.3.3
#r "nuget: ExcelAssistant, 1.3.3"
#addin nuget:?package=ExcelAssistant&version=1.3.3
#tool nuget:?package=ExcelAssistant&version=1.3.3
ExcelAssistant
ExcelAssistant is a .NET library that provides a simple and efficient way to work with Microsoft Excel files. With ExcelAssistant, you can easily read, write, and manipulate Excel files in your .NET applications.
Features
- Read data from Excel files
- Write data to Excel files
- Manipulate Excel files (add, delete, rename sheets, set sheet color, etc.)
- Set cell values and formats
- Set column width and row height
- Apply styles to cells and sheets
Installation
You can install ExcelAssistant using NuGet:
Install-Package ExcelAssistant
.NET CLI Console
dotnet add package ExcelAssistant
Getting Started
Writing a Excel File
Let's look at how we can create and write excel files. In our example, we will use the simple "Report" record model, but it can be any other c# class.
using ExcelAssistant;
//Create a list of test data
var records = new List<Report>()
{
new("Maki", "test@gmail.com", 100),
new("Smith", "test1@gmail.com", 200),
new("Lara", "test2@gmail.com", 450),
};
//Open or create the file for reading (the file will be in the project output directory)
using var stream = File.OpenWrite("records.xls");
//Create an instance of ExcelWriter.
using var writer = new ExcelWriter();
//Write records into the file
writer.WriteRecords(stream, records);
//"Report" model
public record Report(string Name, string Email, decimal Balance);
Also, we can change our output file header by adding configuration:
var config = new ExcelConfiguration
{
HumanReadableHeaders = new Dictionary<string, string>()
{
{nameof(Report.Name), "Customer Name"},
{nameof(Report.Email), "Customer Email"},
}
};
using var stream = File.OpenWrite("records.xls");
using var writer = new ExcelWriter(config);
writer.WriteRecords(stream, records);
Reading files where table headers are the same as c# model properties:
using var stream = File.OpenRead("records.xls");
using var reader = new ExcelReader(stream);
var records = reader.Read<Report>();
Now reading files using the configuration mentioned above
using var stream = File.OpenRead("records.xls");
using var reader = new ExcelReader(stream, config);
var records = reader.Read<Report>();
The library provides the opportunity for manual reading. Method Read return IEnumerable<Dictionary<string,string>> where key is the column name and value is the data for the specific row.
using var stream = File.OpenRead("records.xls");
using var reader = new ExcelReader(stream, config);
var records = reader
.Read()
.Select(rowData => new Report(
rowData[nameof(Report.Name)],
rowData[nameof(Report.Email)],
decimal.Parse(rowData[nameof(Report.Balance)])
))
.ToList();
License
ExcelAssistant is released under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 was computed. 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. |
-
net8.0
- FuzzySharp (>= 2.0.2)
- NPOI (>= 2.6.2)
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.6.3 | 159 | 4/11/2025 |
1.6.2 | 435 | 12/17/2024 |
1.6.1 | 95 | 12/17/2024 |
1.6.0 | 92 | 12/17/2024 |
1.5.4 | 498 | 8/16/2024 |
1.5.3 | 194 | 7/16/2024 |
1.5.2 | 106 | 7/16/2024 |
1.5.1 | 128 | 7/2/2024 |
1.5.0 | 99 | 7/2/2024 |
1.4.0 | 116 | 6/27/2024 |
1.3.6 | 180 | 6/3/2024 |
1.3.5 | 110 | 6/3/2024 |
1.3.3 | 290 | 1/19/2024 |
1.3.2 | 124 | 1/19/2024 |
1.3.1 | 124 | 1/19/2024 |
1.3.0 | 304 | 11/16/2023 |
1.2.4 | 289 | 8/11/2023 |
1.2.3 | 223 | 7/18/2023 |
1.2.2 | 174 | 7/17/2023 |
1.2.0 | 191 | 5/4/2023 |
1.1.2 | 160 | 5/4/2023 |
1.1.1 | 199 | 5/1/2023 |
1.1.0 | 188 | 5/1/2023 |
1.0.0 | 202 | 4/28/2023 |