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
0
votes
1 answer

0002 string value getting truncated to 2 while converting to DataTable using ExcelDataReader

private DataTable ExcelToDataTable(IFormFile file) { using (var stream = file.OpenReadStream()) { using (var reader = ExcelReaderFactory.CreateReader(stream)) { var result =…
Amit
  • 167
  • 1
  • 2
  • 14
0
votes
1 answer

How to enforce untyped columns in ExcelDataReader?

How do you prevent dates or times getting strictly-formatted? I'm reading an XLS file using reader.AsDataSet, and when the source data is 12/12/2014 then this generates an output of 12/12/2014 12:00:00AM. Also, when the source is for example…
Alex Gordon
  • 57,446
  • 287
  • 670
  • 1,062
0
votes
3 answers

Insert into database from an Excel file only rows that don't exist, using C#, EF, and SQL Server

I read an Excel file and insert that data into a database table, but every time I do this, it adds the existing rows plus the new data, I only want to insert the rows that aren't already in the table, my unique ID is the current time stamp. For…
0
votes
0 answers

How get a named range from an excel sheet using ExcelDataReader.Dataset

I am using the ExcelDataReader.Dataset package to read in .xlsx files and store specific sheets as a DataTable, like so: public void SelectWorkbookClick(string s) { string fileName = string.Format("{0}\\{1}", WorkbookFolder, Workbook); …
Alfie
  • 297
  • 1
  • 12
0
votes
1 answer

How to read excel from ajax to web api

Here's my ajax call: $.ajax({ type: "POST", url: "/api/excels/Upload", data: $file, contentType: false, processData: false …
mcfred
  • 1,183
  • 2
  • 29
  • 68
0
votes
1 answer

Weird XLS file failing when using ExcelDataReader

I'm working with a XLS spreadsheet that is rendered from a third-party software. If I open the file in a text editor it's obvious that it's HTML saved as an XLS file. It appears that MS used to allow this pattern and has recently stopped in Excel…
Jeremy Lattimore
  • 276
  • 3
  • 10
0
votes
0 answers

DataTable/DataSet to IFormFile(Excel) to Unit Test

I am unit testing a new API. I need to write a test method to call a method that converts excel to datatable using ExcelDataReader.DataSet. The ExcelDataReader library documentation doesn't indicate that there is any method to go form a dataset to…
0
votes
1 answer

C# Reading excel files >100MB

So I'm trying to read an excel file with C# and the document is 181MB. I have tried using Microsoft.Office.Interop.Excel, OpenXML, ClosedXML, and ExcelDataReader. I wasn't able to get OpenXML to work and ClosedXML seems to have issues with large…
Jummi
  • 123
  • 1
  • 13
0
votes
2 answers

How to pass multiple Excel sheets as data table when using ExcelDataReader?

I would like to know how I can pass more than just one "sheet" in below code? I am filling in some data within a web app using Selenium C# where when information on "Sheet1" are filled up, I have to move on to fill in information from "Sheet2".…
J.FromHeaven
  • 343
  • 3
  • 9
0
votes
2 answers

Change only choosen columns to a custom format while remaining all columns stay intact in WPF DataGrid?

Edit: I tried the StringFormat, it's working fine but the DataGrid showing only those columns that I've included in Actually only VALUE and DATE should be formatted, remaining columns should stay intact. Means now I've to manually…
Dante123
  • 45
  • 7
0
votes
1 answer

ExcelDataReader 3.4 - System.IO.FileLoadException

I'm using ExcelDataReader 3.4 and it work fine on my developer PC, but when used on production PC, I've got this error System.IO.FileLoadException: Could not load file or assembly 'System.IO.Compression, Version=4.2.0.0, Culture=neutral,…
Raphael
  • 813
  • 1
  • 8
  • 17
0
votes
2 answers

How to check if there is two consecutive rows and empty rows until a filled rowusing DataRow C#?

I have a code that tells user which cells they have left empty or which rows they did not fill out but now users want me to allow them to leave at least two rows EMPTY consecutively. So I need to change my validation code to work in these…
Gerle Batde
  • 183
  • 3
  • 21
0
votes
1 answer

Type or namespace ExcelDataReader could not be found - but everything compiles and runs ok

VS2017 C# I am getting the above error, crazy thing is, everything compiles and runs and the ExcelData Reader is working fine! I updated the package using the Manage->Nuget.. but still showing the error..
0
votes
1 answer

How can I get specific info from exception to add it in my own message?

I am retrieving data from a xlx/xlxs file. I'm actually using ExcelDataReader library to save the data into a DataSet using ExcelDataReader plugin. excelReader = ExcelReaderFactory.CreateBinaryReader(stream); excelDataTable =…
Dopefish
  • 3
  • 4
0
votes
0 answers

ExcelReaderFactory.CreateOpenXmlReader(stream) throws a "Value cannot be null" when called more than once

The following code executes fine on a first pass, but on the second pass reader = ExcelReaderFactory.CreateOpenXmlReader(stream); throws a System.ArgumentNullException: 'value cannot be null' public IEnumerable GetFileContents() …
Richard Watts
  • 954
  • 2
  • 8
  • 21