[python-win32] Reading .py or .pyc from an excel sheet

Suraj Barkale suraj at barkale.com
Fri Feb 1 14:48:30 CET 2008


Hi,
Pallavi Apotikar <pallavi.apotikar <at> tcs.com> writes:
> 
> I know how to write the macro using
> VB, but I don't know how to do the same thing using python -- where is
> the option available etc.
    You can not run Python inside excel but you can use COM to get data from an
excel sheet using same API as VBA. I have found that using the Excel API is a
pain. If you just want to read data from Excel please check this out:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440661
http://www.lexicon.net/sjmachin/xlrd.htm
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/483742

> Can you give me any reference?
I have found this (http://starship.python.net/crew/pirx/spam7/COMtut.PPT)
tutorial to be an excellent introduction to subject.

If you are already familiar with VBA then you might find comtypes easier than
win32com for automating Excel. The comtypes documentation talks about using
Excel (http://starship.python.net/crew/theller/comtypes/).


Regards,
Suraj



More information about the python-win32 mailing list