ExcelReaderFactory.CreateBinaryReader(stream) is returning an empty DataTable

Mar 7, 2013 at 7:45 AM
Edited Mar 7, 2013 at 7:48 AM
Im using ExcelDataReader v2.1.dll, Jan 17, 2013, Beta
 public static DataTable ReadArchiveData(string fileName)
    {
        FileStream stream = File.Open(fileName, FileMode.Open, FileAccess.Read);
        //IExcelDataReader excelReader =  ExcelReaderFactory.CreateOpenXmlReader(stream); // Excel 2007 ++
        IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream);  // excel 97 - 2003

        excelReader.IsFirstRowAsColumnNames = true;

        DataSet result = excelReader.AsDataSet();

         excelReader.Close();
        return result.Tables["Archive data"];
    }
When i use
 IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream); 
ReadArchiveData return 0 rows. If i convert the same Excel file to .xlsx format and then use
IExcelDataReader excelReader =  ExcelReaderFactory.CreateOpenXmlReader(stream); 
ReadArchiveData returns the correct number of rows.

Unfortunately, all the Excel files i want to process are all Excel 2003(.xls).
What could be causing this, how can i get it return the correct rows in my worksheet or how can i convert the workbook to .xlsx because thats what works for me now before reading the file?.
Developer
Mar 8, 2013 at 3:08 PM
Where was the xls generated from?
Are you able to provide a test file?
Dec 26, 2013 at 7:37 AM
I am also facing same problem.