0

I'm doing the following

    var stream = File.Open(path, FileMode.Open, FileAccess.Read);
    IExcelDataReader reader = ExcelReaderFactory.CreateOpenXmlReader(stream);

however, i get the error on the second line saying

"Severity Code Description Project File Line Suppression State Error CS0266 Cannot implicitly convert type 'Excel.IExcelDataReader' to 'Assignment9.Controllers.IExcelDataReader'. An explicit conversion exists (are you missing a cast?)"

I have added install-package exceldatareader, etc.

1 Answer 1

1

From the details of the exception you have another type with the same name in the Assignment9.Controllers namespace . Check your project (probably the Assignment9/Controllers folder) to see if you created another IExcelDataReader that is causing the conflict. The assumption here is that Excel.ExcelReaderFactory.CreateOpenXmlReader actually returns Excel.IExcelDataReader

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.