Quantcast
Channel: Excel Data Reader - Read Excel files in .NET
Viewing all articles
Browse latest Browse all 448

Created Unassigned: Excel Data Reader unable to read all columns data [13764]

$
0
0
I am using [Excel Data Reader](https://exceldatareader.codeplex.com/) to read my excel. my code is

```
IExcelDataReader reader = null;

FileStream stream = System.IO.File.Open(file.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

if (file.FileName.EndsWith(".xls"))
{
reader = ExcelReaderFactory.CreateBinaryReader(stream);
}
else if (file.FileName.EndsWith(".xlsx"))
{
reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
}
else
{
reader = null;
}

reader.IsFirstRowAsColumnNames = true;

var exceldata = reader.AsDataSet().Tables[0];
```

I have more than 400 rows and 10 columns in excel But exceldata is returning only first column data. All 400 rows with only first column data.

What i am missing? Please help.

Viewing all articles
Browse latest Browse all 448

Trending Articles