Questions tagged [exceldatareader]

Questions about ExcelDataReader, a .NET library for reading Microsoft Excel files. When using this tag, also tag the question with the programming language being used unless your question is not specific to any programming language.

ExcelDataReader is a lightweight and fast .NET library written in C# for reading Microsoft Excel (97 and newer) files.

Cross-platform:

  • Windows with .Net Framework 2
  • Windows Mobile with Compact Framework
  • Linux, OS X, BSD with Mono 2+

Project page at CodePlex: http://exceldatareader.codeplex.com/

Latest sources available at GitHub: https://github.com/ExcelDataReader/ExcelDataReader

For more information read its Read-Me file at GitHub.

141 questions
1
vote
0 answers

How to to check Excel sheet column-name row using ExcelDataReader?

Assume I have an Excel work sheet with first row that must be column names: FirstName LastName DepartmentId <-- first row is column names john doe 1 jane doe 2 ... I have 2 questions: - How can I check if the…
Thomas.Benz
  • 8,381
  • 9
  • 38
  • 65
1
vote
2 answers

ExcelDataReader not reading the xls file in some cases

When using excelDatareader for some Excel file the ExcelReaderFactory.CreateOpenXmlReader(stream) is returning null and not taking the filestream. But for some excel file it is running perfect. Can somebody explain me the reason? static void…
neo
  • 437
  • 7
  • 25
1
vote
0 answers

Read column values with formula Excel Data Reader not working

My Excelsheet looks like this: http://cdn.imghack.se/images/cdc24215d3d5079628a58878520c3028.png Here is the part of my method that matters: [HttpPost] public ActionResult ShowExcelFile(GetExcel model) { DataSet result = null; var file =…
MrProgram
  • 5,044
  • 13
  • 58
  • 98
1
vote
0 answers

AccessViolationException when opening Excel file

I'm using .net 4.0. I used an OpenFileDialog to read data from an Excel sheet. At the first time the OpenFileDialog works great and I get the file but after I close it and reopen it to get another file the AccessViolationException shows up. The…
1
vote
0 answers

ExcelDataReader - Index was outside the bounds of the array

fileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read); //1. Reading from a binary Excel file ('97-2003 format; *.xls) IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream); //... //2. Reading from a OpenXml…
John
  • 3,965
  • 21
  • 77
  • 163
1
vote
0 answers

How to read selected Excel column

Using the ExcelDataReader from http://exceldatareader.codeplex.com and this 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…
0
votes
3 answers

Excel raw date number representation incoherency

[C# 9.0 and net7.0] (* main request edit) (Why can excel have the same date value representation as different dates? 43708 can be 31/08/19 and 01/09/23) As stated by @user8728340's response, this happens because of a misalignment of bool literals…
0
votes
1 answer

C# - ExcelDataReader - Is it possible to include empty cells in DataSet?

I have this excel file: When I read cell 'A1' I get "Daniel". Is it possible to make ExcelDataReader include empty rows/columns cells? Instead of reading the value of cell 'A1' -> 'Daniel' I want 'A1' cell to contain null as the excel file…
Saraf
  • 200
  • 10
0
votes
0 answers

C# column length of dataset created by Excel with ExcelDataReader is always -1

I import a file into a dataset with this method using the ExcelDataReader library using ExcelDataReader; public DataSet EstraiContenuto(IFormFile file) { using (var inputStream = new MemoryStream()) { // read file to…
gt.guybrush
  • 1,320
  • 3
  • 19
  • 48
0
votes
2 answers

How to read only columns from Excel using ExcelDataReader?

I am using below code to read column names from Excel sheet. It's working fine. But it loads entire sheet data into datatable. It takes a lot of time. Is there any way we can read only column names and not load whole sheet? using (var stream =…
SAT
  • 192
  • 2
  • 15
0
votes
0 answers

C# ExcelDataReader and OpenXML both skipping empty columns

I'm trying to read data from an Excel file into a datatable. Some of the cells in the Excel may be empty. Both the libraries are skipping empty cells and hence the order in datatable is wrong. For example, if the Excel is like this: Name Contact …
Ashutosh
  • 4,371
  • 10
  • 59
  • 105
0
votes
0 answers

How to configure ExcelReaderFactory to solve problem of Encoding in c#?

I use ExcelDataReader.DataSet nuggetPackage var reader = ExcelReaderFactory.CreateReader(stream); var conf = new ExcelDataSetConfiguration { UseColumnDataType = true, …
vlad
  • 1
  • 1
0
votes
0 answers

Open .xlsb with ExcelDataReader

ExcelDataReader documentation says that it can open .xlsb files. using (var stream = File.Open(filePath, FileMode.Open, FileAccess.Read)) { // Auto-detect format, supports: // - Binary Excel files (2.0-2003 format; *.xls) // - OpenXml…
Loc Dai Le
  • 1,661
  • 4
  • 35
  • 70
0
votes
2 answers

C# ExcelDataReader Invalid File Signature

I've already looked at this and it did not solve my issue https://stackoverflow.com/questions/51079664/c-sharp-error-with-exceldatareader I've tried building a method that reads an XLS file and converts it to string[] But I get an error when trying…
Daedalus
  • 1
  • 4
0
votes
0 answers

ExcelDataReader C#. Setting specific row as column header

I am working with the Spreadsheet below. Spreadsheet FileStream fs = File.Open(dialog.FileName, FileMode.Open, FileAccess.Read); using (IExcelDataReader reader = ExcelReaderFactory.CreateReader(fs)) { …