Open MS Excel Spreadsheet with Python

Bob Gailer bgailer at alum.rpi.edu
Fri Sep 12 11:51:21 EDT 2003


At 08:16 AM 9/12/2003, Ajith Prasad wrote:

>Would appreciate any advice on how to get started with the script.
>Created an empty spreadsheet "test.xls" on drive F. Then at the
>PythonWin prompt tried and obtained:
> >>> xlapp=UseExcel("f:\test.xls")

What precedes this code> Where does UseExcel() come from?

Try "f:\\test.xls" (\t is the tab character and must be escaped)

>Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
>   File "UseExcel.py", line 16, in __init__
>   File "<COMObject <unknown>>", line 2, in Open
>com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Excel',
>"'f:\test.xls' could not be found. Check the spelling of the file
>name, and verify that the file location is correct.\n\nIf you are
>trying to open the file from your list of most recently used files on
>the File menu, make sure that the file has not been renamed, moved, or
>deleted.", 'C:\\Program Files\\Microsoft
>Office\\Office10\\1033\\xlmain10.chm', 0, -2146827284), None)

[snip]

Bob Gailer
bgailer at alum.rpi.edu
303 442 2625
-------------- next part --------------

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.506 / Virus Database: 303 - Release Date: 8/1/2003


More information about the Python-list mailing list