[Pythonmac-SIG] Pythonmac-SIG Digest, Vol 95, Issue 20

Dan Ross dan at rosspixelworks.com
Fri Mar 18 14:32:06 CET 2011



Ok. I figured the CSV part out, but paths for saving in appscript are
kicking my butt. 

If anyone has any suggestions I'd appreciate them.


Thanks, 

Dan 

On Fri, 18 Mar 2011 12:00:02 +0100,
pythonmac-sig-request at python.org wrote:  

Hi there- 

I have the
following AppleScript: 

set theOutputPath to (path to desktop folder as
string) & "My Saved Workbook.csv"
tell application "Microsoft Excel"

tell active workbook
 save workbook as filename theOutputPath file
format CSV file format
 end tell
end tell 

This works fine. When I try
to use appscript I cannot get the stinking spreadsheet to save as a CSV
file with the following: 

from appscript import *

excel =
app('/Applications/Microsoft Office 2008/Microsoft
Excel')
excel.open('/Users/danr/Desktop/Test.xlsx')
name =
excel.worksheets[1].name.get()
print(name)
excel.worksheets[1].save_as(filename
= 'boogers.csv', file_format = "CSV") 

Any pointers? 

Thanks, 

Dan 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20110318/6e01ee49/attachment.html>


More information about the Pythonmac-SIG mailing list