Hi
I was able to read the excel with oledbconnection and was getting in a datatable form.
But when I am trying to use a excel which is downloaded from web application from gridview then its not able to read it, throwing error "External table is not in the expected format."
Please help me on this as I am stuck here,not able to move further.
Regards
Rohan

Ramesh MaruthiRank #937 · 2.2K reputationPosted Sep 10, 2014, 7:11 AM EDT
so when your downloading the file from web application what format does the download file has ?
Nitesh KejriwalRank #253 · 9.9K reputationPosted Sep 10, 2014, 8:00 AM EDT
Rohan Gupta5 reputationPosted Sep 10, 2014, 9:00 PM EDT
Rohan Gupta5 reputationPosted Sep 10, 2014, 11:45 PM EDT
Candy Brown24 reputationPosted Dec 2, 2014, 11:34 PM EST
Hi, are you sure you have an XLS format, you know there is a commonly used workaround for generating an excel file on a server side in which you actually create a HTML formatted file and rename it into an XLS extension and MS Excel will be able to read them. To add just in case, for XLS format you need Microsoft.Jet.OLEDB.4.0, while for an XLSX file you need Microsoft.ACE.OLEDB.12.0.
Any way you can try some other approach, see here how you can read your excel files in C# on the server side and a rather simple way how you can export that excel to a DataTable instance.