1. Products
  2.   Editor
  3.   .NET
  4.   ExcelDataReader
 
  

Open Source .NET SDK for working with Excel XLS, XLSX, CSV and XLSB files

Free & Powerful Open Source .NET API to work with Spreadsheet XLS, XLSX, CSV and XLSB files.

What is ExcelDataReader API for .NET?

ExcelDataReader is an open-source library for .NET that enables developers to read data from Excel files in the formats XLS (Excel 97-2003) and XLSX (Excel 2007+). It is lightweight and fast, making it a popular choice for handling Excel files in .NET applications. The API does not support writing to Excel files but focuses solely on efficient reading.

ExcelDataReader for .NET API - Key Features

Following are some of the main features of ExcelDataReader:

  • Read XLS and XLSX formats: Supports both binary (XLS) and OpenXML (XLSX) formats.
  • No Excel Interop required: The library works without the need for Excel to be installed on the machine.
  • Memory-efficient: Handles large Excel files without consuming excessive memory.
  • Simple API: Easy to use for quickly reading data from Excel sheets.
  • Support for DataSet: Can load Excel data into a DataSet or DataTable for easy integration with ADO.NET components.
  • Support for stream input: Allows reading from streams, making it suitable for server-based applications where files are uploaded.
These features show the capabilites and advantages of using ExcelDataReader API for .NET in Spreadsheet automation tasks.
GitHub

GitHub Stats

Name:
Language:
Stars:
Forks:
License:
Repository was last updated at

Getting Started with ExcelDataReader for .NET API

You can download the ExcelDatareader library from nuget.

Installation

Installing ExcelDataReader is simple and can be done from nugget as shown below:

Installing ExcelDatareader API for .NET


 Install-Package ExcelDataReader -Version 3.6.0

Code Examples for ExcelDataReader API for .NET

ExcelDataReader is a powerful .NET API that can be used to read Spreadsheet files from within your .NET applications. You can find C# exampeles for reading Excel files, protected Spreadsheet files, and apply formatting to Excel files using C#.

How to Read Excel Files using ExcelDataReader .NET API?

ExcelDataReader lets you read Excel files from within your C#/.NET application. You can use the following steps to read an Excel file:

  • Start by creating an instance of the ExcelReaderFactory class.
  • Read the Excel file into a DataSet
  • Access the first table (worksheet)
  • Loop through the rows and columns of the table

Important note on .NET Core

ExcelDataReader throws a NotSupportedException "No data is available for encoding 1252." on .NET Core and .NET 5.0 or later by default. You will have to add a dependency to the package System.Text.Encoding.CodePages in order to fix this. You will also addd code to register the code page provider during application initialization (e.g. 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 and .NET 5.0 or later.

Conclusion

ExcelDataReader is a powerful and efficient open-source API for reading Excel files in .NET applications. Its lightweight nature, combined with support for both XLS and XLSX formats, makes it ideal for scenarios where fast data extraction from Excel files is needed. While it lacks the ability to write or format Excel files, it excels at reading and processing large datasets without the overhead of additional dependencies or Excel installations. For applications where reading Excel data is the primary need, ExcelDataReader provides a reliable and straightforward solution, integrating seamlessly with .NET's DataTable and DataSet structures.

Similar Products