Home » excel » Trying to open an excel sheet in C# but getting provider is not installed

Trying to open an excel sheet in C# but getting provider is not installed

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have installed the 64 bit version of ACE but its not working for some reason. I keep getting the provider is not not registered on the machine. I am using the following connection string.

OleDbConnection connection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.16.0;Data Source=" + filePath + ";Extended Properties='Excel 12.0'");

Do I need something extra to use 64 bit version?

How to&Answers:

With default project settings, .NET apps compiled as “Any CPU” binaries will execute as 32-bit processes even on 64-bit Windows. Not sure why, probably some old compatibility reasons.

Very easy to change. Open project properties, “Build” tab, and uncheck “Prefer 32-bit” checkbox. With that checkbox unchecked, your app will execute as 64 bit process on 64 bit OSes, then you’ll get the 64-bit version of ACE you’ve installed.