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

Graeme Glass graemeglass at gmail.com
Thu Jan 31 11:01:59 CET 2008


On Jan 31, 2008 11:43 AM, Pallavi Apotikar <pallavi.apotikar at tcs.com> wrote:

>
> Hello Sir/Madam,
>
> I would like to know, is it possible to read a python file from an excel
> sheet ?
>
> Thanks and Regards
>
> Pallavi Ajabrao Apotikar
>


I don't fully understand what you are asking,

But...

If you where however asking, if it is possible to display the contents of a
python script in an excel sheet, yes it's possible (it's just text), why you
would want to? a .pyc file would be pretty meaningless to you as it is a
'compiled' python script, and is 'bytecode'.

If you where asking if you could control excel via a python script, which I
think is the most plausible, the answer is a resounding yes!

There are countless examples on this mailing list of such tasks.

Google for 'python +excel', will bring up loads of examples.

(http://www.oreilly.com/catalog/pythonwin32/chapter/ch12.html)

import win32com.client
xl = win32com.client.Dispatch("Excel.Application")
xl.Visible = 1


I hope one of these answers will help with what you where asking.

G
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20080131/1b3c27a4/attachment.htm 


More information about the python-win32 mailing list