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 Main(string[] args)
{
FileStream stream = File.Open(@"C:\Users\nichi-user\Desktop\BLRJCCI.xls", FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
DataSet result = excelReader.AsDataSet();
result.Tables[0].TableName.ToString();
}