If you’re doing any .Net ADO work with an Excel sheet, and want to explicitly enable or disable automatic handling of the first row of the sheet being set as a heading by the data handler, you have to set HDR=YES or NO in the connection string’s ‘Extended Properties’. OK, you may say, but what I ran into the other day was the following helpful message as soon as those properties were added to my connection string:

“Could not find installable ISAM”.

Huh? What’s happened? Dave’s started banging his head against a brick wall, that’s what.

It turns out that the formatting of the connection string has to be quite strict (read: stick random linebreaks in) to get it to work, so here is how I managed to get the damn thing working again:

OleDbConnection connString = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;" +
 "Data Source=c:\somefile.xls;" +
 "Extended Properties=" + (char)34 + "Excel 8.0;HDR=Yes;" + (char)34);

Hope that helps some poor sucker scouring the web who’s run into the same issue.

One Response to “C# ADO with Excel (HDR=YES) – Could not find installable ISAM.”

  1. Fuck Face Says:

    Boring!

Leave a Reply