Last post Jun 12, 2014 03:13 AM by azadhussain
Jun 11, 2014 05:14 AM|azadhussain|LINK
I am trying to read xlsx file with oledbconnection, getting Error " External table is not in the expected format. " when attempting to open connection.
Code i am using : Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\TempFileUpload\file.xlsx;Extended Properties="Excel 12.0;HDR=No;IMEX=1;"
But i have tested it with some other file having xlsx and it's working fine but there is issue with other file that's also have same extension xlsx.
I would really appritiate it any one can help me to get it resolve.
Jun 11, 2014 08:07 AM|VickySan|LINK
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
The connection string in below format seems to fix most problems.
string path =
string connStr =
+ path +
";Extended Properties=Excel 12.0;";
string path =
Jun 12, 2014 03:13 AM|azadhussain|LINK
i am using same code as you gave me, over all it's working fine, the problem there were some issue in file, when i save file in new location
as a save as then it's working fine,
Thanks once again.
And my new problem : My dataset have data with date and it's have m/d/yyyy format but i need MM/dd/yyyy format ,
and my query is : query = "SELECT * from [" + sheetName + "$B3:IM8] where [F1]='Date Value' or [F1]='Data Value'";
could you suggest me to get date in MM/dd/yyyy format.