How do I access Microsoft Excel 365 using C# in Visual Studio

0

I created an app that reads excel spreadsheets and performs actions on the data. I created the app using Excel 2010 and 2013. My company recently went to Office 365. Now when I run my application I get the error listed below. I assume this has something to do with Microsoft.Office.Interop.Excel but I cannot find any information on this error and how to fix it.

"Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."

c#
office365
excel-2016
asked on Stack Overflow Nov 6, 2016 by Cass

2 Answers

0

If you do not need to control the excel application itself, you really don’t need interop. See the answers to this question or this for how to read data from xlsx sheets. There is also a neat article on codeproject, which explains OleDb.

answered on Stack Overflow Nov 6, 2016 by Nomenator • edited May 23, 2017 by Community
0

I faced the exact same exception when my computer was upgraded to Office 365. In my C# code, I was using test data stored in ".xlsx" file earlier.

I switched the excel file name to ".xls" and ran the same code that was leveraging Excel.Application and other classes from Microsoft.Office.Interop.Excel library, it worked fine.

answered on Stack Overflow Nov 22, 2017 by user8992796

User contributions licensed under CC BY-SA 3.0