Controlling Excel with win32com

Al Christians achrist at
Thu Nov 17 08:09:17 CET 2005

I'm starting to test a python application that creates an Excel 
workbook, then fills in values for some cells and formulas for other 
cells.  The formulas involve circular references, which will cause Excel 
to take a little time to update and iterate through the successive 
approximations of finding a solution to the formulas.  (The system 
should converge pretty well -- no bad behavior expected.)

Since Excel runs as a com server in another window, is there anything 
that the python side of the win32com connection has to do to make sure 
that it is not calling Excel while Excel is busy recalculating or 
otherwise processing a previous request?  Are the assignments to the 
cell Value  and Formula properties synchronized for me somewhere?

I think that I've noticed a run-sometimes/crash-sometimes behavior in 
this program, but I'm so clueless about what's going on behind the 
scenes with com that I haven't really tied it down.  It seemed to get 
better behaved when I turned off automatic recalculation,  but that does 
not seem to me to be a guarantee that there will be no timing problems 
if the messages are not queued somewhere and if there is not some other 
mechanism to keep things synchronized.

What works best?



More information about the Python-list mailing list