Name: [002] Ian Ozsvald
Member: 128 months
Authored: 181 videos
Description: I am the co-founder of ShowMeDo (see, author of `The Screencasting Handbook <>`_ and the founder of the professional screencast production company `ProCasts <>`_: .. image:: ...

COM and Python with pyWin32 [ID:219]

a series of video-tutorials by Ian Ozsvald

Learn to talk to COM-enabled applications on Windows using the open-source pyWin32 (by Mark Hammond). Here we use Python to control Excel, then we create a Python-based COM server which we call from inside Excel. Possible applications - use Excel as a charting tool, build a scientific/research interface to your Python code, communicate with any COM application, build your own COM servers.

Video Tutorials

1. 3 Minute Overview (pyWin32)

Here we use pyWin32 to communicate via COM with COM-enabled Windows applications. Our examples use Excel - we send data to it, read data from it and then build a COM server which Excel can talk to. In these demos I'm assuming you have numerical data that you want to graph - perhaps for science research. You're not limited to numeric data though - COM allows you to pass other data types too of c [...]

2. Talking to Excel with pyWin32

Here we test pyWin32 (build 210) on Windows XP using Python 2.5 with Excel 2000. Topics: Starting Excel using COM, making it Visible Referencing a workbook and sheet Reading/writing data to Excel cells Setting a sheet's name 0 or 1 based indexing For reference and further notes on 0 and 1 based indexing: pyWin32 FAQ tutorial and links to MS documentation You'll want to buy Python Programm [...]

3. Tip - Cleanly Quit Excel and del the local reference

When working with pyWin32 you'll probably run into this problem - you've worked with Excel and then closed it, you try to open it again and you get a half-broken screen. What's going on?! The problem is that pyWin32 hasn't let go of its reference - if you look in the task-manager you'll see 'EXCEL.EXE' is still running. Here I show you how to cleanly shut-down Excel when you're done with it usi [...]

4. Quick Graphing via Excel

Would you like to output some numbers in Python and see them graphed in Excel? This is really easy to do if we have an Excel XLS sheet already setup with a graph object. NOTE - I mention SaveAs, I show this in the next episode

5. Using Excel for Input

Now let's expand upon the previous episode and use Excel for a tiny bit of user-input which is then passed back to Python. Python uses this input to manipulate some numbers which are sent back to Excel for graphing. This gives us the basics of a research tool when you just need a simple user-interface to complement some Python number crunching.

6. A COM Server in Python in 20 Lines

Finally let's look at building a COM server in Python which is called from within Excel. We'll develop a 'hello' function and a more complex Factorial function using pyWin32's COM interface.

Showmedo is a peer-produced video-tutorials and screencasts site for free and open-source software (FOSS)- with the exception of some club videos, the large majority are free to watch and download.

how to help » about » faq »

Educating the Open-source Community With Showmedo

Although as important as the software it supports, education and documentation are relatively neglected in the Open-source world. Coders love to code, and explaining how best to use or improve the software tends to be deferred or even sidelined.

At Showmedo we believe the community can play a vital role here and also say thanks for the tools and software that make our lives easier. If you have a piece of software you love or a programming langugage you are enthusiastic about, why not make a screencast showing others how to use it? All the stuff you wish you'd been told, the tips, tricks, insights that would have saved you time and frustration.

Screencasting is easier than you think, and we're happy to help you. You can emailus for advice or just use some of the how-to screencasts on the site. This screencasting learning-pathis a good place to start.

Kudos and Thanks for Ian

3 Minute Oveview (What Does Python Look Like?)

simple and informative. you draw me in
70 months ago

Learning Paths

This series lies on the following learning-paths. Learning-paths are a new initiative at Showmedo, to start structuring our content better. You can find out more here.



Showmedo's development is fairly rapid and bugs will inevitably creep in. If you have any problems please drop us a line using the contact address below. Likewise, any suggestions for improvements to the site are gratefully received.