Calling Python Script from MS Excel?

Giles Brown giles_brown at
Tue Jun 8 11:13:46 CEST 2004

"Kevin T. Ryan" <kevryan0701 at> wrote in message news:<40c51309$0$2944$61fed72c at>...
> Hi Group - 
> I have written a "semi-program" in MS Excel related to running a football
> pool.  I've updated it over the past two years or so, to the point where it
> is getting pretty advanced.  Only, there are a few tricks that I want to
> add that I could not do in Excel - so I did them in Python :)  Except as it
> stands, the current python scripts have to be run via the command line. 
> Does anyone know how to allow interaction between Excel and Python via
> I've looked on Mark Hammond's page, and I've figured out how to interact
> with Python and Excel from PYTHON, but I can't seem to find the right info
> for making the calls from the other end (i.e. from Excel).  Any advice
> would be GREATLY appreciated!

One way of approaching this would be to package your Python code 
as a COM server.  This is actually much easier than you might think
(this reference is quite old but is still relevant):

You can make calls on your object from Excel VBA.  For example you
could call on the object in the reference above as:

Dim HelloWorld As Object

Set HelloWorld = CreateObject("testcomserver.HelloWorld")
MsgBox HelloWorld.Hello("Kevin")


More information about the Python-list mailing list