This is the code which i was using before the Office 2016 installation.
var excelApp = new Excel.Application();
excelApp.Visible = true;
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(finfo.FullName, 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, false, false);
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelSheets.get_Item(currentSheet);
var cellValue =(excelWorksheet.Cells[a, b] as Excel.Range).Value;
The code worked fine but after Office 2016 installation i have seen that i couldn't use
using Excel = Microsoft.Office.Interop.Excel;
The only compatible library that i found is
Microsoft.Office.Core (Microsoft Office 16.0 Object Library)
I could't find any examples accesing Excel files. Is there any other way to access Excel files with Office 2016 installed(PIA)
This is the Error which I get when i try to run the code
Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Excel.Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155).
We had this error on one of our computers. We ran an Apps & Features -> 'Quick Repair' on Office 365 and this fixed the issue.