使用Applescript从Excel保存清洁CSV文件

我有一个过程,需要从Web下载Excel电子表格,使用Excel Mac 2008打开它,将其保存为csv文件,然后使用phpparsing。 手动过程工作正常,并保存一个干净的CSV文件。 我试图使用Applescript自动化这个部分,而且它的工作方式很多,但是生成的CSV文件包含了一些奇怪的字符。

这是我正在研究的Applescript:

tell application id "com.microsoft.Excel" to open "~/Documents/input.xls" tell application id "com.microsoft.Excel" to tell active sheet to save in ("output.csv") as "CSV file format" 

我已经尝试了各种CSV选项(Mac,Windows,MSDos),并没有产生实质性的不同结果。

尝试这个…

 set theDoc to (path to desktop as text) & "test.xlsx" set outPath to (path to desktop as text) & "test.csv" tell application "Microsoft Excel" open file theDoc tell workbook 1 tell sheet 1 save in outPath as CSV file format end tell close without saving end tell end tell