I am creating a small application to import excel data into my database, when i click the button it crashes with the error
External table is not in
Assuming you have done all the preparations including installing Microsoft Access 2010 Runtime to acquire the relevant drivers try the following as I had success with it in the past.
If your input file is of a type *.xlsx
trying replacing
Extended Properties="Excel 12.0"
in your connection string with
Extended Properties="Excel 12.0 Xml"
This issue normally happens with the problematic or mismatching format of Excel file so as a rule of thumb the first thing you would want to try is to open Excel and create a new .xlsx
file with couple of sample data in it which you typed yourself (rather than copy/paste). You don't need much typing to test your code snippet. Couple of cells with the right info you're expecting will do. This approach eliminates having any problems with the actual Excel file rather than your C# code.
Let us know how you went.