How to read excel data to datatable using OPENXML?

Posted by Sahoo under ASP.NET on 9/17/2013 | Points: 10 | Views : 6301 | Status : [Member] | Replies : 2
Hi All,

I want to read data from an excel file and want to store it in a datatable. Previously I was using interop excel.But it give COM exception many time.So I want to switch to OPENXML . But I am unable to read xls file in it .It is showing Corrupted data exception .Any 1 has sample code to fix it.
Which is better to read excel file ?

Is dere any way to stop COM exception ?




Responses

Posted by: Allemahesh on: 9/17/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
You can see the below links:- This may be help.

http://stackoverflow.com/questions/3321082/from-excel-to-datatable-in-c-sharp-with-open-xml
http://stackoverflow.com/questions/11811143/export-datatable-to-excel-with-open-xml-sdk-in-c-sharp

Happy Coding
If it helps you or directs U towards the solution, MARK IT AS ANSWER

Sahoo, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Thackeray on: 5/28/2014 [Member] Starter | Points: 25

Up
0
Down
Using OPENXML to read excel documetn data is more complex than using the excel reading tool I am using now, if you need, you can have a try.

http://www.rasteredge.com/how-to/vb-net-imaging/excel-reading/



Sahoo, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response