In this programming tutorial we will learn how to fix this error: External table is not in the expected format. Few days ago one of my friend asked me to provide the code that import excel data to asp:gridview. I gave him the link of the import excel data to gridview article but he suddenly asked me that he is getting the above mentioned error. I checked his code and fixed the error. Let's have a look over how i fixed this nasty error.
External table is not in the expected format
This error normally 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 this error.
That's it. Just change the connection string for Excel 2007- 2010 files.
I love your feedback.
This error normally 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 this error.
public static string path = @"C:\Project\MyWeb\UploadedFiles\users.xlsx"; //Path of your excel located in server public static string connStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;";
That's it. Just change the connection string for Excel 2007- 2010 files.
I love your feedback.
0 comments:
Post a Comment