BikaLibs.ExcelReaderToDTO
1.0.3
dotnet add package BikaLibs.ExcelReaderToDTO --version 1.0.3
NuGet\Install-Package BikaLibs.ExcelReaderToDTO -Version 1.0.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="BikaLibs.ExcelReaderToDTO" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BikaLibs.ExcelReaderToDTO" Version="1.0.3" />
<PackageReference Include="BikaLibs.ExcelReaderToDTO" />
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 BikaLibs.ExcelReaderToDTO --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BikaLibs.ExcelReaderToDTO, 1.0.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 BikaLibs.ExcelReaderToDTO@1.0.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=BikaLibs.ExcelReaderToDTO&version=1.0.3
#tool nuget:?package=BikaLibs.ExcelReaderToDTO&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ExcelReaderToDTO
a simple way to read excel files and map them to DTOs
Usage
- Download and install the package
- Create a DTO class that has properties with ExcelColumnAttribute matching atleast one column in the excel file
public class ProductDTO
{
[ExcelColumn("Product Name")]
public string Name { get; set; }
[ExcelColumn("Price")]
public decimal Price { get; set; }
[ExcelColumn("Quantity")]
public int Quantity { get; set; }
}
- read the excel file into MemoryStream
var stream = new MemoryStream(File.ReadAllBytes("path/to/excel/file.xlsx"));
- Use the
ExcelReaderto read the file and map it to the DTO
var productList = ExcelReader.Read<ProductDTO>(stream);
- Use the list of DTOs as needed
foreach (var product in productList)
{
Console.WriteLine($"Name: {product.Name}, Price: {product.Price}, Quantity: {product.Quantity}");
}
Notes
- The
ExcelColumnAttributeis used to map the properties of the DTO to the columns in the Excel file. - The
ExcelReaderwill automatically map the columns based on the attribute names. - The DTO class must have properties that match the column names in the Excel file (atleast one).
- The Excel file must have a header row with the column names that match the
ExcelColumnAttributenames. - The package uses
EPPlusfor reading Excel files, so make sure to include it in your project dependencies (if needed). - The package supports only
.xlsxformats. - Note that this package is using
Reflectionto map the properties, so it may have performance implications for large files or many DTOs.
| 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. net10.0 was computed. 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.
-
net8.0
- EPPlus (>= 8.0.8)
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.0.3 | 216 | 8/11/2025 |