[python-win32] Excel
Tim Roberts
timr at probo.com
Tue Jan 10 20:51:33 CET 2006
On Wed, 11 Jan 2006 00:12:28 +0800, "Stefan Elwesthal"
<elwis at linuxmail.org> wrote:
>
> I have to ask, cause two days later I'm starting to get annoyed ;-)
>
> How could I use PythonCOM and save my re-worked Excel file as an xlCSV
> file? All I get is
> "SaveAs method in Worksheet class failed".
>
> Is something wrong with this line?
> sh.SaveAs("C:\file.csv", FileFormat='xlCSV')
>
Besides the xlCSV constant issue, there is another problem. "\f" is not
two characters -- it is one character, the ASCII formfeed. You either
need to escape it or use the other slash:
sh.SaveAs( "c:/file.csv", FileFormat=win32com.constants.xlCSV )
or
sh.SaveAs( "c:\\file.csv", FileFormat=win32com.constants.xlCSV )
or
sh.SaveAs( r"c:\file.csv", FileFormat=win32com.constants.xlCSV )
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-win32
mailing list