2 Replies Latest reply: Dec 5, 2012 10:57 AM by Pete Siemsen
Pete Siemsen Level 1 Level 1 (5 points)

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"

          open "/Users/siemsen/PetesLookup/BPO.inventory.current.xls"

          save active workbook in "BPO.inventory.current.csv" as CSV file format

  close workbook 1 saving no

  quit

end tell

 

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?


MacBook Pro, Mac OS X (10.6.7)