I am doing a project in C# and I have downloaded ExcelDataReader from codeplex and added it to my project reference. There is an error in namespace 'using Excel;
' though I have added Excel
, Excel.4.5
, Microsoft.Office.Interop.Excel
to my project references. I'm getting error where I have written
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
The errors are quoted below:
The type or namespace name 'ExcelDataReader' could not be found (are you missing a using directive or an assembly reference?) The name 'ExcelReaderFactory does not exist in the current context
How to deal with these errors?
Thank you in advance.
PS:- I have added 'using Excel = Microsoft.Office.Interop.Excel
' directive as well.
Go to Project -> Manage NuGet Packages..., in opened window select Browse tab and type Excel Data Reader, install it, at the top of your class add using Excel
. Then you will be able to use interface IExcelDataReader
.
Here is the source:
https://forums.asp.net/t/1981566.aspx?The+type+or+namespace+name+IExcelDataReader+could+not+be+found