Newbie : Python and Excel
Harald Massa
cpl.19.ghum at spamgourmet.com
Sun May 25 05:49:44 EDT 2003
> i'm trying to save an excel file to a CVS txt file format thru the com
> client interface and it's going pretty bad !!
>
> == snippet ==
>
> App = win32com.client.dynamic.Dispatch('Excel.Application')
> Book = App.Workbooks.Open('aa.xls')
> Book.SaveAs('bb',FileFormat = 'xlCSV')
> App.close()
your problem is
FileFormat = 'xlCSV'
xlCSV is no Text (THAT would be in Python and work *G*)
xlCSV is a Integer.
I usually use MakePy to create Excel-Bindings as in a file like
"Excel.py",
python makepy.py -o Excel
so I can write
import Excel
App=Excel.Application()
Book=App.Workbooks.Open('aa.xls')
Book.SaveAs('bb', FileFormat=Excel.constants.xlCSV)
App.Quit()
(makepy is with the win32all extensions)
More information about the Python-list
mailing list