1097 Views 2 Replies Latest reply: Dec 5, 2012 10:57 AM by Pete Siemsen
Every night at 2:00am, I want to convert an Excel spreadsheet to CSV. I'm doing this on a Mac, with Excel 2011. The following Applescript works sometimes:
tell application "Microsoft Excel"
save active workbook in "BPO.inventory.current.csv" as CSV file format
close workbook 1 saving no
With the above script saved in a file named convert.scpt, I can execute it from a bash script using the command "osascript convert.scpt". The bash script runs in a launchd job at 2:00am every day.
It works if Excel is already running on the Mac at the time the cron job runs. If not, it starts Excel, which insists on displaynig a "Excel Workbook Gallery" dialog box. No one is present on the Mac at the time, so no one clicks on the "Cancel" in the dialog box, so the Applescript times out and the cron job fails.
How do I get around this? Can I somehow start Excel without the **** "Excel Workbook Gallery" dialog? Is there some other trick that will allow the job to run unattended?