将html转换为excel? [英] Converting html to excel?

查看:303
本文介绍了将html转换为excel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道excel可以直接打开html文件。但该文件的内容仍然是HTML。有没有什么办法可以将文件内容从html更改为xls或xlsx?

解决方案

只要Excel可以打开该文件以及用于更改已打开文件格式的功能都已内置。



要转换 .html 文件,请使用Excel打开它(文件 - 打开),然后将其另存为一个来自Excel的文件(文件 - 另存为)。



使用VBA ,代码如下所示:

  Sub Open_HTML_Save_XLSX()

Workbooks.Open文件名:= C:\Temp\Example.html
ActiveWorkbook.SaveAs文件名:= _
C:\Temp\Example.xlsx,FileFormat:= _
xlOpenXMLWorkbook

结束Sub


I know that excel is capable of opening html files directly. But the content of the file will still be html. Is there any way I can change the contents of the file from html to xls or xlsx?

解决方案

So long as Excel can open the file, the functionality to change the format of the opened file is built in.

To convert an .html file, open it using Excel (File - Open) and then save it as a .xlsx file from Excel (File - Save as).

To do it using VBA, the code would look like this:

Sub Open_HTML_Save_XLSX()

    Workbooks.Open Filename:="C:\Temp\Example.html"
    ActiveWorkbook.SaveAs Filename:= _
        "C:\Temp\Example.xlsx", FileFormat:= _
        xlOpenXMLWorkbook

End Sub

这篇关于将html转换为excel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆