2
Vote

Excel Data Reader unable to read all columns data

description

I am using Excel Data Reader 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.

comments

pceend wrote Oct 14, 2016 at 11:35 AM

I have the same problem it is only importing the first column of the excel file into the data set. Really stange because for other files it is working.

Did you find a solution?

Kind regards,

Jorrit

wrote Oct 14, 2016 at 11:35 AM