Skip navigation

how to run Excel 2011 from applescript for batch

726 Views 2 Replies Latest reply: Dec 5, 2012 10:57 AM by Pete Siemsen RSS
Pete Siemsen Calculating status...
Currently Being Moderated
Dec 5, 2012 8:15 AM

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


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)


More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.