0

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!

Paul Rubel
  • 26,632
  • 7
  • 60
  • 80
Shuaib
  • 779
  • 2
  • 13
  • 47
  • Please check the following question and be sure to change platform target at exactly same place as on the screenshot there: http://stackoverflow.com/questions/4214527/could-not-find-installable-isam – EvAlex Mar 09 '13 at 06:44
  • I guess one of the forum suggested to use a single code. Just give a try as like below. 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'"; – Smaug Mar 09 '13 at 07:00

1 Answers1

1

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.

Mohammad Dehghan
  • 17,853
  • 3
  • 55
  • 72
  • 1
    @Shuaib there is a tickbox next to answers, mark correct ones as this saves people time letting them know your issue is resolved and it gives you a couple of points too. Good luck! – Jeremy Thompson Mar 09 '13 at 07:35