Reputation: 753
I want to connect to a .xlsx file from my ASP.NET application.
Here is my connection string:
string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};Data Source=\"C:\\MyExcel.xlsx\";Extended Properties=\"Excel 12.0 Xml;HDR=NO\"";
OleDbConnection oleConnection = new OleDbConnection(connString);
But when I try to open the connection I get Could not find installable ISAM
I even changed the platform target of my app to x86 but no success.
Please help!
Upvotes: 0
Views: 2265
Reputation: 18443
Change the connection string to:
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\"C:\\MyExcel.xlsx\";Extended Properties=\"Excel 12.0 Xml;HDR=NO\"";
The Driver=...
part is required when you are connecting using ODBC driver. When connecting using OLEDB, specifying the Provider
is sufficient. Refer to this page for more information.
Upvotes: 1