I have a process that requires downloading an Excel Spreadsheet from the Web, opening it using Excel Mac 2008, saving it as a csv file, and then parsing it using php. The manual process works fine and saves a clean CSV file. I am trying to automate this part using Applescript, and it sort of works, however, the CSV file generated contains a bunch of weird characters.
Here is the Applescript I am working 开发者_运维知识库on:
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"
I have tried various CSV options (Mac, Windows, MSDos) and they do not produce substantially different results.
Try this...
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
精彩评论