Live conversation between Python and an Excel spreadsheet

Steve Holden sholden at holdenweb.com
Tue Aug 31 07:26:45 EDT 2004


quadric at primenet.com wrote:

> Hi,
> I have an application that requires that Python initiate and mediate a 
> live and iterative conversation
> between an external application (in which Python is embedded) and an 
> external Excel
> spreadsheet.  Python will have to pass info to the spreadsheet, 
> spreadsheet will make
> calculations, Python will obtain results and pass back to application,  
> application will evaluate
> results of spreadsheet calculations and create new set of data and 
> instructions, Python will pass
> new data and instructions to spreadsheet,  loop goes on 'n' times until 
> convergence to solution
> or no solution.  Python terminates conversation and returns control to 
> application until next
> 'conversation'.
> 
> If I had my choice (which I don't) I would re-code the spreadsheet in 
> Python, but that is not an
> option in this case.
> 
> Is there anyone on the list that has done this before and has an elegant 
> solution?  If so, what Python modules should I look at?  Are there any 
> good Python books out there that have
> examples of this?
> 
> I am experienced with Python and have some knowledge of COM objects etc....
> 
> Any help would be very much appreciated.
> 
> Thanks
> 
> 
Your best bet would be to interact with Excel as a COM object, as 
described in the excellent "Python Programming on Win32" by Robinson and 
Hammond. However, be aware that you'll probably end up ferreting around 
to find out about undocumented methods of Excel objects, as the docs are 
often far from complete.

regards
  Steve



More information about the Python-list mailing list