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

Pallavi Apotikar pallavi.apotikar at tcs.com
Thu Jan 31 11:36:08 CET 2008


Actually, I have an excel sheet, where I am entering the data.

I am reading the entered data in python.

excel takes data as a string.

before passing it to python, i wanted to check whether the entered 
data(value) is a valid python data type. 

so instead of checking this in python script(/ say program), I wanted to 
put macro in excel , so that all the values are checked at a stretch (or 
say while entering - before passing it to the python program.)

So is it possible ?

Pallavi Ajabrao Apotikar
Tata Consultancy Services
Mailto: pallavi.apotikar at tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty.   IT Services
                        Business Solutions
                        Outsourcing
____________________________________________



"Graeme Glass" <graemeglass at gmail.com> 
01/31/2008 03:31 PM

To
"Pallavi Apotikar" <pallavi.apotikar at tcs.com>
cc
python-win32 at python.org
Subject
Re: [python-win32] Reading .py or .pyc from an excel sheet







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
ForwardSourceID:NT00006176 
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20080131/8cf9b994/attachment-0001.htm 


More information about the python-win32 mailing list