error : External table is not in the expected format.
code:
connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" + @"Data Source=" + fName + ";" + @"Jet OLEDB:Database Password=Test" + ";" + @"Extended Properties=" + Convert.ToChar(34).ToString() + @"Excel 8.0" + Convert.ToChar(34).ToString() + ";";
OleDbConnection OleDbcon = new OleDbConnection(connectionString);
OleDbDataAdapter adp = new OleDbDataAdapter("select * from [Sheet1$]", OleDbcon);
adp.FillSchema(dt1, SchemaType.Source);
adp.Fill(dt1);
OleDbDataAdapter adp = new OleDbDataAdapter("select * from [Sheet1$]", OleDbcon);
adp.FillSchema(dt1, SchemaType.Source);
adp.Fill(dt1);

Nilesh JadavRank #109 · 20.3K reputationPosted Apr 18, 2017, 7:55 AM EDT
"External table is not in the expected format." typically occurs when trying to use an Excel 2007 file with a connection string that uses: Microsoft.Jet.OLEDB.4.0 and Extended Properties=Excel 8.0
Using the following connection string seems to fix most problems.
Change your extension according to the version of excel you are using, also add HDR ="Yes" or "No". Hope that helps !Uehara AyakaRank #2,730 · 512 reputationPosted Apr 18, 2017, 4:57 PM EDT