Ninjanaut.BinaryExcelReader 1.0.0

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

// Install Ninjanaut.BinaryExcelReader as a Cake Tool
#tool nuget:?package=Ninjanaut.BinaryExcelReader&version=1.0.0                

Welcome to the BinaryExcelReader project website! BinaryExcelReader is lightweight C# library to ease loading data from Excel binary (xlsb) file format into DataTable object, based on Microsoft OLE DB Driver. Also supports xls, xlsx and xlsm formats.

if you don't need to load .XLSB format, consider to use excel reader without OLE DB Driver dependency Ninjanaut.ExcelReader

Installation

from nuget package manager console

PM> Install-Package Ninjanaut.BinaryExcelReader

from command line

> dotnet add package Ninjanaut.BinaryExcelReader
Version Targets
1.x .NET 5

Features

  • Loading from file path via sheet name.
  • Duplicate columns are implicitly allowed.
    • Columns A, B, B, B1 will be loaded as A, B, B1, B11 (this is OLE DB Driver default setting).
  • Another options might be set via options parameter
Descriptions Options Defaults Notes
Skip top rows HeaderRowIndex 0 Keep in mind that OLE DB driver does not take into account blank rows. For example, if you have 4 additional non-header rows from top and two of them are blank, the header row index is 2. Warning: if the row contains formatting, it is not considered blank.
Remove empty rows RemoveEmptyRows true If set to false and the row does not contains anything (even formatting), then the row will not be loaded anyway.
Limit max columns to load MaxColumns null I recommend setting this value so that you don't accidentally load empty columns.
Skip header row HeaderExists true If set to false, HeaderRowIndex property is ignored.

Usage

using Ninjanaut.IO;

// From file path
var path = @"C:\FooExcel.xlsx";
var sheetName = "Sheet1"
var datatable = BinaryExcelReader.ToDataTable(path, sheetName);

you can also use options argument

using Ninjanaut.IO;

var path = @"C:\FooExcel.xlsx";
var sheetName = "Sheet1"
var options = new BinaryExcelReaderOptions 
{ 
    // Default settings:
    HeaderExists = true
    HeaderRowIndex = 0,
    RemoveEmptyRows = true,
    MaxColumns = null,
});

var datatable = BinaryExcelReader.ToDataTable(path, sheetName, options);

// The options may be defined within the method.
var datatable = ExcelReader.ToDataTable(path, sheetName, new() { MaxColumns = 5 });

Notes

DataTable object is suitable for this purpose, because you can easily view the read data directly in Visual Studio for debug purposes, create a collection of entities from it or pass datatable as parameter directly into the SQL server stored procedure.

Contribution

If you would like to contribute to the project, please send a pull request to the dev branch.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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. 
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.1.0 289 4/17/2023
2.0.0 542 9/5/2021
1.0.0 375 9/4/2021