C# Excel file OLEDB read HTML IMPORT

試著忘記壹切 提交于 2019-11-29 10:59:15

I asked this same question on another forum and got the answer so I figured I'd share it here. As per this article: http://ewbi.blogs.com/develops/2006/12/reading_html_ta.html

Instead of using the sheetname, you must use the page title in the select statement without the $. SELECT * FROM [HTMLPageTitle]

I've been searching so many solution, end up I found something really simple and easy - to import XML file to Excel file, I tried to convert XML to HTML first, use -

http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=63

then I found I could easily change my output file as .xls, instead of .html

        //create the output stream
        XmlTextWriter myWriter = new XmlTextWriter
("result.html", null);

then the output is perfect Excel file from my XML data file.

hope this will save ur work.

Vedigoundan G

I have run into the same problem. As previously mentioned, it seems to be an html file renamed to .xls. When I copy the data from the xls to a new xls, I can read the new xls with the E.P. set to "Excel 8.0".

In this scenario, the file couldn't be saved in the correct format. So we have to convert that file to the correct format. To do this, use MS Office Excel 2007, Click File -> Convert. The file will be converted to the right format automatically.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!