GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - aadil79/ExcelDataReader: Lightweight and fast library written in C# for reading Microsoft Excel files

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

49 Commits
49 Commits

Folders and files

NameName
Last commit message
Last commit date
.nuget
.nuget
 
 
BuildProcessTemplates
BuildProcessTemplates
 
 
Excel.4.5
Excel.4.5
 
 
Excel.Tests.4.5
Excel.Tests.4.5
 
 
Excel.Tests
Excel.Tests
 
 
Excel
Excel
 
 
ExcelDataReader.Android
ExcelDataReader.Android
 
 
ExcelDataReader.Desktop
ExcelDataReader.Desktop
 
 
ExcelDataReader.Portable
ExcelDataReader.Portable
 
 
ExcelDataReader.Silverlight
ExcelDataReader.Silverlight
 
 
ExcelDataReader.iOS
ExcelDataReader.iOS
 
 
Lib
Lib
 
 
NuGetBin
NuGetBin
 
 
Silverlight
Silverlight
 
 
TestApp
TestApp
 
 
output
output
 
 
.gitignore
.gitignore
 
 
Excel.Test.20.testsettings
Excel.Test.20.testsettings
 
 
Excel.Test.4.5.vsmdi
Excel.Test.4.5.vsmdi
 
 
Excel.Test.sln
Excel.Test.sln
 
 
Excel.Test.vsmdi
Excel.Test.vsmdi
 
 
Excel.testsettings
Excel.testsettings
 
 
ExcelDataReader.2.1.2.1.nupkg
ExcelDataReader.2.1.2.1.nupkg
 
 
ExcelDataReader.sln
ExcelDataReader.sln
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
portable_reademe.md
portable_reademe.md
 
 
test.runsettings
test.runsettings
 
 

Repository files navigation

ExcelDataReader

Lightweight and fast library written in C# for reading Microsoft Excel files

This project has just migrated from CodePlex - as is. Please feel free to fork and submit pull requests.

Note Please try the latest source from the repo before reporting issues as there have been recent changes. Also, if you are reporting an issue it is really useful if you can supply an example excel file as this makes debugging much easier and without it we may not be able to resolve any problems.

This project is using a git-flow style workflow so please submit pull requests to the develop branch if possible.

Finding the binaries

It is recommended to use Nuget

Install-Package ExcelDataReader

The current binaries are still on the codeplex site, but these will not be updated going forward. If there are enough requests for separate binary hosting other than nuget then we'll come up with some other solution.

How to use

C# code :

FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read);

//Choose one of either 1 or 2
//1. Reading from a binary Excel file ('97-2003 format; *.xls)
IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream);

//2. Reading from a OpenXml Excel file (2007 format; *.xlsx)
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);

//Choose one of either 3, 4, or 5
//3. DataSet - The result of each spreadsheet will be created in the result.Tables
DataSet result = excelReader.AsDataSet();

//4. DataSet - Create column names from first row
excelReader.IsFirstRowAsColumnNames = true;
DataSet result = excelReader.AsDataSet();

//5. Data Reader methods
while (excelReader.Read())
{
	//excelReader.GetInt32(0);
}

//6. Free resources (IExcelDataReader is IDisposable)
excelReader.Close();

VB.NET Code:

Dim stream As FileStream = File.Open(filePath, FileMode.Open, FileAccess.Read)

'1. Reading from a binary Excel file ('97-2003 format; *.xls)
Dim excelReader As IExcelDataReader = ExcelReaderFactory.CreateBinaryReader(stream)

'2. Reading from a OpenXml Excel file (2007 format; *.xlsx)
Dim excelReader As IExcelDataReader = ExcelReaderFactory.CreateOpenXmlReader(stream)

'3. DataSet - The result of each spreadsheet will be created in the result.Tables
Dim result As DataSet = excelReader.AsDataSet()

'4. DataSet - Create column names from first row
excelReader.IsFirstRowAsColumnNames = True
Dim result As DataSet = excelReader.AsDataSet()

'5. Data Reader methods
While excelReader.Read()
	'excelReader.GetInt32(0);
End While

'6. Free resources (IExcelDataReader is IDisposable)
excelReader.Close()

Tips

  • SQL reporting services. Set ReadOption.Loose in the CreateBinaryReader factory method to skip some bounds checking which was causing SSRS generated xls to fail. (Only on changeset >= 82970)

About

Lightweight and fast library written in C# for reading Microsoft Excel files

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.