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" />
                    
Directory.Packages.props
<PackageReference Include="BikaLibs.ExcelReaderToDTO" />
                    
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 BikaLibs.ExcelReaderToDTO --version 1.0.3
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=BikaLibs.ExcelReaderToDTO&version=1.0.3
                    
Install as a Cake Tool

ExcelReaderToDTO

a simple way to read excel files and map them to DTOs

Usage

  1. Download and install the package
  2. 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; }
}
  1. read the excel file into MemoryStream
var stream = new MemoryStream(File.ReadAllBytes("path/to/excel/file.xlsx"));
  1. Use the ExcelReader to read the file and map it to the DTO
var productList = ExcelReader.Read<ProductDTO>(stream);
  1. 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 ExcelColumnAttribute is used to map the properties of the DTO to the columns in the Excel file.
  • The ExcelReader will 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 ExcelColumnAttribute names.
  • The package uses EPPlus for reading Excel files, so make sure to include it in your project dependencies (if needed).
  • The package supports only .xlsx formats.
  • Note that this package is using Reflection to map the properties, so it may have performance implications for large files or many DTOs.
Product 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.

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