read excel 2016 with c#

Occasional Visitor

I have reciently installed Office 2016, and tried to read an Excel spreadsheet programically using C#.   I get the following error "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine".   I have searched the web, and there is very little about it using OLEDB with Excel 2016.   I have installed various 2007 or 2010 Access runtimes.   My connection string is "conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileParam + ";Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1\"");".   Does anyone have a suggestion for me to try?

3 Replies

Try downloading and installing the Microsoft.ACE.OLEDB.12.0 Data Provider that is part of the Microsoft Access Database Engine. Link: https://www.microsoft.com/en-us/download/details.aspx?id=13255


The page here give more information about the process: 


Just ran into this issue on a Windows 10/Office 2016/Visual Studio 2015 Enterprise/SQL Server 2016 PC immediately after the Fall 2018 Windows Updates were forced onto the PC.  I opened an SSIS package that imported data from Excel and Visual Studio kept crashing when viewing the DTSX package.


After extensive searching and a long-running repair on Visual Studio did nothing, I found this post and then ran the installer for the 32-bit Access 2010 Database Engine (even though my OS is 64-bit, SSIS needs 32-bit).  As soon as I did that, everything magically worked!


Your suggestion really saved me.


I was having an issue with Opening Excel files.


I could Open ‘.xls’ fine, but when I tried Opening an ‘.xlsx’ file, it  made the windows form all weird – small Scale and it changed the positon of the form (to the left side of the screen.  I was also using the correct connection string (for ‘.xlsx’ files).  What was really weird is, that the sizes etc., all said the same thing before and after.


After trying everything that I could think of, and spending several hours at it, I ran across your comment.  I installed the old Database Engine, downloaded and installed the 32-bit version of the database engine.


After that, the problem was solved!


Thank you John!

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
50 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
32 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
15 Replies
Dev channel update to 80.0.355.1 is live
josh_bodner in Discussions on
67 Replies