C# – Accessing Excel 2007 file format with OLEDB

cexcelms-officeoledb

I'm currently trying to access an excel 2007 file on a server that doesn't contain Microsoft Office on it. My connectionstring is something like this.

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

But this is for 2003 format, which works fine. I would like to take advantage of the 2007 xml format. But I'm unable to access the file through the following connection.(The target server doesn't have Office installed on it, not sure if thats the reason.

  String connString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
 "DataSource=" + file_path + ";HDR=Yes;IMEX=1;Extended Properties=Excel 12.0;";

I'm keep getting the "could not find installable isam." Error.

EDIT
I'm using visual studio 2005 and developing in C# if this helps clear anything up.

Best Answer

You may try with this connection string:

string connectionString = 
    "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + 
    file_name + 
    ";Extended Properties=\"Excel 12.0 Xml;HDR=YES\"";

Please note though that this driver is not supported on x64 systems and it won't work.

Related Topic