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

Pallavi Apotikar pallavi.apotikar at tcs.com
Mon Feb 4 07:58:10 CET 2008


I am sorry, instead of "file", I should have said "a python function". 

Is it possible to access/use a python function from Excel VB Editor e.g. a 
library function called "eval()" is used to detect whether the 
expression/datatype is a valid python expression/datatype ?  Can we do 
that?

Thanks and Regards.

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



Larry Bates <larry.bates at websafe.com> 
Sent by: python-win32-bounces at python.org
02/02/2008 01:50 AM

To
python-win32 at python.org
cc

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






Pallavi Apotikar wrote:
> 
> 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_ 
> <mailto: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
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32

Is sound line you should write the entire data entry program in wxWindows 
using 
the wxGrid (which looks like Excel to the end user).  Then you can control 
the 
data that goes into each cell with your Python program.

-Larry

_______________________________________________
python-win32 mailing list
python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32

ForwardSourceID:NT000063AA 
=====-----=====-----=====
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/20080204/a54eadb7/attachment.htm 


More information about the python-win32 mailing list