read excel 2016 with c#

Copper Contributor

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: 

https://social.technet.microsoft.com/wiki/contents/articles/24236.importing-an-excel-spreadsheet-int...

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!