本文介绍了将Excel工作表另存为HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将工作表中的每个工作表( foo , bar , baz )保存为单独的HTML文档( foo.html , bar.html , baz.html ):
I'm attempting to save each sheet in a workbook (foo,bar,baz) as a separate HTML document (foo.html,bar.html,baz.html):
set theDirectory to (path to desktop as text) & "Output:" set theSource to choose file with prompt "Choose file:" default location "/Users/<user>/Desktop/" of type {"XLS", "XLSX"} tell application "Microsoft Excel" activate set theWorkbook to open theSource set theSheets to every sheet of active workbook repeat with theSheet in theSheets set theDestination to theDirectory & (the name of theSheet) & ".html" log theDestination tell theSheet save as sheet filename theDestination file format HTML file format end tell end repeat quit saving no end tell结果:
-
Output 中每个工作表(名为<工作表名称> _files )的文件夹,其中包含每个工作表的HTML文档(命名为 sheet< n> .html ),以及一些其他文件( filelist.xml , stylesheet.css , tabstrip.html )
a folder in Output for each sheet (named <sheet name>_files) that contains an HTML document for each sheet (named sheet<n>.html), plus a few additional files (filelist.xml,stylesheet.css,tabstrip.html)
Output 中的每个引用相应文件夹的工作表(名为.html`)的文件
a file in Output for each sheet (named .html`) that references the corresponding folder
我该如何纠正?
推荐答案此脚本:
set theSource to choose file with prompt "Choose file:" default location (path to desktop) of type {"XLS", "XLSX"} set theDestination to (choose folder with prompt "Choose destination folder:" default location path to desktop) set thePath to (theDestination as text) & "data.HTML" tell application "Microsoft Excel" activate open theSource tell active workbook save as active sheet filename thePath file format HTML file format end tell quit saving no end tell会生成:
- 名为 data.HTML 的文件
- 一个名为 data_files 的文件夹,其中包含每个工作表的文档( sheet< NNN> .HTML ),以及其他文件( filelist.xml , stylesheet.css , tabstrip.html )
- a file named data.HTML
- a folder named data_files, containing a document for each sheet (sheet<NNN>.HTML), plus additional files (filelist.xml,stylesheet.css,tabstrip.html)
更多推荐
将Excel工作表另存为HTML
发布评论