Windows – Opening an Excel spread sheet in .NET on a x64 system

64-bitmicrosoft excelnetwindows

I can't open an Excel spread sheet with .NET on an x64 server using the following connection string

"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + filePath + "; Extended Properties=Excel 8.0;"

I get The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.

I installed the 2007 Office System Driver: Data Connectivity Components and tried with Microsoft.ACE.OLEDB.12.0 and this connection string

"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + filePath + "; Extended Properties=Excel 8.0;"

and got "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine."

I searched Google with the only response being it's a 64 bit problem, anyone have an Idea how to fix this?

Best Answer

You can use the Open XML SDK to open an Excel 2007 file and read or change the contents.

http://www.microsoft.com/downloads/details.aspx?FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0&DisplayLang=en

This does not use the Excel program but opens it as an xml document. Thus you get around the 64bit problem.

It may however require major changes to your program.