Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Calling Python functions from Excel
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Cannonbiker  
View profile  
 More options Nov 15, 2:20 am
Newsgroups: comp.lang.python
From: Cannonbiker <lusve...@gmail.com>
Date: Sat, 14 Nov 2009 23:20:35 -0800 (PST)
Local: Sun, Nov 15 2009 2:20 am
Subject: Calling Python functions from Excel
Hi,
unfortunately is my question about server COM (win32com)
http://groups.google.com/group/comp.lang.python/browse_thread/thread/...
without answer.

Please I need Calling Python functions from Excel and receive result
back in Excel. Can me somebody advise simplest solution please? I am
more VBA programmer than Python.

Thanks


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carsten Haese  
View profile  
 More options Nov 15, 2:53 am
Newsgroups: comp.lang.python
From: Carsten Haese <carsten.ha...@gmail.com>
Date: Sun, 15 Nov 2009 02:53:49 -0500
Local: Sun, Nov 15 2009 2:53 am
Subject: Re: Calling Python functions from Excel

Cannonbiker wrote:
> Please I need Calling Python functions from Excel and receive result
> back in Excel. Can me somebody advise simplest solution please? I am
> more VBA programmer than Python.

Maybe this will help:
http://oreilly.com/catalog/pythonwin32/chapter/ch12.html (Scroll down to
"Implementing a COM Server.")

--
Carsten Haese
http://informixdb.sourceforge.net


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Darcy Mason  
View profile  
 More options Nov 16, 8:34 am
Newsgroups: comp.lang.python
From: Darcy Mason <darcyma...@gmail.com>
Date: Mon, 16 Nov 2009 05:34:27 -0800 (PST)
Local: Mon, Nov 16 2009 8:34 am
Subject: Re: Calling Python functions from Excel
On Nov 15, 2:20 am, Cannonbiker <lusve...@gmail.com> wrote:

> Please I need Calling Python functions from Excel and receive result
> back in Excel. Can me somebody advise simplest solution please? I am
> more VBA programmer than Python.

A couple of years ago I used MSScriptControl for this. Couldn't find a
great reference just now, but here is a discussion which should give
enough information:
http://www.velocityreviews.com/forums/t319222-re-python-in-excel.html

Check from around message 3 on.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Withers  
View profile  
 More options Nov 17, 6:36 am
Newsgroups: comp.lang.python
From: Chris Withers <ch...@simplistix.co.uk>
Date: Tue, 17 Nov 2009 11:36:33 +0000
Local: Tues, Nov 17 2009 6:36 am
Subject: Re: Calling Python functions from Excel

Cannonbiker wrote:
> Hi,
> unfortunately is my question about server COM (win32com)
> http://groups.google.com/group/comp.lang.python/browse_thread/thread/...
> without answer.

> Please I need Calling Python functions from Excel and receive result
> back in Excel. Can me somebody advise simplest solution please? I am
> more VBA programmer than Python.

Try http://code.google.com/p/pyinex/

cheers,

Chris


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Tolonen  
View profile  
 More options Nov 17, 11:23 am
Newsgroups: comp.lang.python
From: "Mark Tolonen" <metolone+gm...@gmail.com>
Date: Tue, 17 Nov 2009 08:23:39 -0800
Local: Tues, Nov 17 2009 11:23 am
Subject: Re: Calling Python functions from Excel

"Chris Withers" <ch...@simplistix.co.uk> wrote in message

news:4B028AC1.8020307@simplistix.co.uk...

> Cannonbiker wrote:
>> Hi,
>> unfortunately is my question about server COM (win32com)
>> http://groups.google.com/group/comp.lang.python/browse_thread/thread/...
>> without answer.

>> Please I need Calling Python functions from Excel and receive result
>> back in Excel. Can me somebody advise simplest solution please? I am
>> more VBA programmer than Python.

> Try http://code.google.com/p/pyinex/

The book Python: Programming on Win32 has a whole chapter on COM, and a
section on COM servers.

-Mark


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Withers  
View profile  
 More options Nov 17, 11:40 am
Newsgroups: comp.lang.python
From: Chris Withers <ch...@simplistix.co.uk>
Date: Tue, 17 Nov 2009 16:40:03 +0000
Local: Tues, Nov 17 2009 11:40 am
Subject: Re: Calling Python functions from Excel

Mark Tolonen wrote:

>>> Please I need Calling Python functions from Excel and receive result
>>> back in Excel. Can me somebody advise simplest solution please? I am
>>> more VBA programmer than Python.

>> Try http://code.google.com/p/pyinex/

> The book Python: Programming on Win32 has a whole chapter on COM, and a
> section on COM servers.

...and it's generally accepted that COM sucks rocks through straws, so
explore alternatives when they're available ;-)

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Tolonen  
View profile  
 More options Nov 17, 9:09 pm
Newsgroups: comp.lang.python
From: "Mark Tolonen" <metolone+gm...@gmail.com>
Date: Tue, 17 Nov 2009 18:09:13 -0800
Local: Tues, Nov 17 2009 9:09 pm
Subject: Re: Calling Python functions from Excel

"Chris Withers" <ch...@simplistix.co.uk> wrote in message

news:4B02D1E3.6080308@simplistix.co.uk...

> Mark Tolonen wrote:

>>>> Please I need Calling Python functions from Excel and receive result
>>>> back in Excel. Can me somebody advise simplest solution please? I am
>>>> more VBA programmer than Python.

>>> Try http://code.google.com/p/pyinex/

>> The book Python: Programming on Win32 has a whole chapter on COM, and a
>> section on COM servers.

> ...and it's generally accepted that COM sucks rocks through straws, so
> explore alternatives when they're available ;-)

> Chris

True, but as usual Python makes it pretty darn easy (requires PyWin32):

------------- ex.py -------------------------------
class Example(object):
    _public_methods_ = ['Add','Mul']
    _reg_progid_ = 'MyPython.Example'
    _reg_clsid_ = '{insert_GUID_here}'

    def Add(self,a,b):
        return a+b

    def Mul(self,a,b):
        return a*b

if __name__ == '__main__':
    import win32com.server.register
    win32com.server.register.UseCommandLine(Example)
---------------------------------------------------------

-------------- Excel Macro ----------------------
Sub Testit()
    Set ex = CreateObject("MyPython.Example")
    Range("A1") = ex.Add(1, 2)
    Range("A2") = ex.Mul(3, 4)
End Sub
--------------------------------------------------------

Just run the script to register the server.  "ex.py --unregister" will
remove it.

-Mark


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ethan Furman  
View profile  
 More options Nov 17, 9:33 pm
Newsgroups: comp.lang.python
From: Ethan Furman <et...@stoneleaf.us>
Date: Tue, 17 Nov 2009 18:33:21 -0800
Local: Tues, Nov 17 2009 9:33 pm
Subject: Re: Calling Python functions from Excel

Chris Withers wrote:
> Mark Tolonen wrote:
>> The book Python: Programming on Win32 has a whole chapter on COM, and
>> a section on COM servers.

> ...and it's generally accepted that COM sucks rocks through straws, so
> explore alternatives when they're available ;-)

+1 QOTW  :D

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cannonbiker  
View profile  
 More options Nov 18, 1:38 pm
Newsgroups: comp.lang.python
From: Cannonbiker <lusve...@gmail.com>
Date: Wed, 18 Nov 2009 10:38:19 -0800 (PST)
Local: Wed, Nov 18 2009 1:38 pm
Subject: Re: Calling Python functions from Excel
On 18 lis, 03:09, "Mark Tolonen" <metolone+gm...@gmail.com> wrote:

Thanks very much. It works perfectly!!! :-)

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google