ExcelReaderMapper 2.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ExcelReaderMapper --version 2.1.0                
NuGet\Install-Package ExcelReaderMapper -Version 2.1.0                
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="ExcelReaderMapper" Version="2.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ExcelReaderMapper --version 2.1.0                
#r "nuget: ExcelReaderMapper, 2.1.0"                
#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.
// Install ExcelReaderMapper as a Cake Addin
#addin nuget:?package=ExcelReaderMapper&version=2.1.0

// Install ExcelReaderMapper as a Cake Tool
#tool nuget:?package=ExcelReaderMapper&version=2.1.0                

ExcelReaderMapper

Lightweight excel reader for .NET application

Build project publish to nuget

This use ExcelDataReader to read the excel file. It will read line one by one. So it optimize the memory

Installation

Download package from NuGet ExcelReaderMapper

Note for .NET CORE

By default, ExcelDataReader throws a NotSupportedException "No data is available for encoding 1252." on .NET Core.

To fix, add a dependency to the package System.Text.Encoding.CodePages and then add code to register the code page provider during application initialization (f.ex in Startup.cs):

System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);

This is required to parse strings in binary BIFF2-5 Excel documents encoded with DOS-era code pages. These encodings are registered by default in the full .NET Framework, but not on .NET Core.

Using

Create a model to mapping with datatype with DisplayAttribute to declare the excel column name

public class ExcelModel
{
    [MappingColumn(Name = "FIRST_NAME")]
    public string FirstName { get; set; }
    
    [MappingColumn(Name = "LAST_NAME")]
    public string LastNane { get; set; }
    
    [MappingColumn(Name = "AGE", CustomFormat = { "dd-mm-yyyy" })]
    public DateTime DateOfBirth { get; set; }
}

Call the excelmapper object

var fileContent = File.ReadAllBytes("Example.xlsx");
var excelMapper = new ExcelMapperService();
var result = excelMapper.GetDataFromExcel<ExcelModel>(fileContent);

Properties

lineOfOffset: It will offset the lines that started reading the excel file (Default = 1)

parsingMethod: Additional parsing method (not to use reflection too much) - refer ParsingMethod enum. (Experimental)

lengthOfHeader: declare length of the header base on lineOfOffset

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
2.3.3 448 11/22/2023
2.3.2 125 11/22/2023
2.3.1 1,365 5/22/2023
2.3.0 476 10/5/2022
2.2.9 468 9/20/2022
2.2.8 443 9/19/2022
2.2.7 458 9/16/2022
2.2.6 494 9/14/2022
2.2.5 430 9/12/2022
2.2.4 430 9/10/2022
2.2.3 421 9/9/2022
2.2.2 433 9/7/2022
2.2.1 428 8/30/2022
2.2.0 426 8/30/2022
2.1.0 442 8/10/2022
2.0.0 419 8/9/2022
1.0.0 452 7/30/2022