By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,954 Members | 1,248 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,954 IT Pros & Developers. It's quick & easy.

Is there a way to push data into Microsoft Excel & Word from Python ?

P: n/a
Is there a way to push data to Microsoft Excel & Word from a Python
Application

Is this a cross platform feature ? I'll need to push data on MS Windows &
Mac OS X ....
Dec 16 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a

The Night Blogger wrote:
Is there a way to push data to Microsoft Excel & Word from a Python
Application
On Windows, it's easy after you install the win32 extensions. For
example, for
python:

import win32com.client
xl = win32com.client.Dispatch('Excel.Application')

after which you can operate on "xl" (almost) as if you were coding in
VBA. I have driven Excel from python a /lot/, and it works well.
Paul Boddie has written a great tutorial---which includes some Outlook
examples, btw---over here:

http://thor.prohosting.com/~pboddie/Python/COM.html
Is this a cross platform feature ? I'll need to push data on MS Windows &
Mac OS X ....
I have zero OSX experience, but 30s of googling brings up this:

http://appscript.sourceforge.net/

Kevin Walzer mentions on this mailing list entry:

http://mail.python.org/pipermail/pyt...st/400255.html

that Excel provides reasonably good support for applescript, but again,
I have no idea whether these things work; I'm just doing your googling
for you.

Assuming applescript works, you may want to write a thin wrapper over
the combination of the win32 COM interface and the applescript
interface that at least lets your business logic sit in one place. The
wrapper can use the right API depending on the platform it finds itself
on at runtime.

Regards
Caleb

Dec 16 '06 #2

P: n/a

The Night Blogger wrote:
Is there a way to push data to Microsoft Excel & Word from a Python
Application

Is this a cross platform feature ? I'll need to push data on MS Windows &
Mac OS X ....
Depends on what you mean by "push". If you wish to create Excel files
but not update existing ones, you might consider pyExcelerator. It is
pure Python and therefore will run on any platform that Python will.
http://cheeseshop.python.org/pypi/pyExcelerator/

Cheers,
John

Dec 16 '06 #3

P: n/a
Caleb Hattingh wrote:
Paul Boddie has written a great tutorial---which includes some Outlook
examples, btw---over here:

http://thor.prohosting.com/~pboddie/Python/COM.html
Thanks for the kind words! The most current location of this tutorial
is here:

http://www.boddie.org.uk/python/COM.html

I don't use Windows any more, but I suppose it's still relevant to at
least some people.

Paul

Dec 17 '06 #4

P: n/a
Hi Paul
Thanks for the kind words!
No, thank _you_ for taking the time to write such a useful document.

regards
Caleb

Dec 21 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.