Open MS Excel Spreadsheet with Python

srijit at yahoo.com srijit at yahoo.com
Wed Jul 16 10:19:49 EDT 2003


Hi,
I am working on Python-Excel interface based on the excellent library
win32com.
I was planning to put it up as a Python recipe in Activestate.
Anyway before that I shall personally send you the code after some
cleanup. It will be good to get an early feedback before I upload it
in Activestate.

Regards,
Srijit

"Allison Bailey" <allisonb at terralogicgis.com> wrote in message news:<mailman.1058229111.12248.python-list at python.org>...
> Hi Folks,
> 
> I'm a brand new Python programmer, so please point me in the right
> direction if this is not the best forum for this question....
> 
> I would like to open an existing MS Excel spreadsheet and extract
> information from specific worksheets and cells.
> 
> I'm not really sure how to get started with this process.
> I ran the COM Makepy utility from my PythonWin (IDE from ActiveSTate),
> using Microsoft Excel 10.0 Object Library, then
> import win32com.client
> xl = win32com.client.Dispatch("Excel.Application")
> wb = xl.Workbooks.Open ("c:\\data\\myspreadsheet.xls")
> 
> Then, I get errors when I try the following:
> sh = wb.worksheets(1)
> 
> 
> I think I'm missing something fairly fundamental, but I've googled all
> over the place and can't seem to find anything very introductory about
> opening and using data from MS Excel using Python.  Any suggestions,
> including places to get more information are welcome.  
> 
> Also, do I need to run the makepy utility every time I run my script?
> If so, how would I do it from within my Python program, rather than with
> the GUI in the IDE?
> 
> Thanks for your help,
> 
> Allison
> 
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Allison Bailey
> TerraLogic GIS, Inc.
> allisonb at terralogicgis.com
> 425-673-4495
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~




More information about the Python-list mailing list