[Tutor] Programming microsoft excel

Alan Gauld alan.gauld at btinternet.com
Fri May 7 09:21:21 CEST 2010


<hbutau at ovi.com> wrote 
> guys can i use python's win32com module to do the same tasks that 
> i do with visual basic for applications (vba). I mean automating tasks 
> for excel e.t.c and accessing Access databases. 

Yes. You can use the MFC API or the WSH API from win32com.

> If win32com doesnt which module can i use?

There are some higher level modules for specific tasks, 
for example working on the registry and specifically for 
manuipulating Excel data. So unless you specifically 
need to control other apps you should consider doing 
the job directly from Python rather than using Python 
as a controller, that will usually be a more robust and 
efficient solution.

You can also access the win32 API using ctypes, but I 
personally find that a bit more complex than using win32com.


Finally, if that is your main interest area I strongly 
recommend Mark Hammond's book "Python Programming 
on Win32", it's a bit dated now but most of it is still valid.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list