Dealing with Excel

Thomas Bartkus thomasbartkus at comcast.net
Tue Oct 18 18:03:05 EDT 2005


"Robert Hicks" <sigzero at gmail.com> wrote in message
news:1129670191.061006.146320 at g47g2000cwa.googlegroups.com...
> I need to pull data out of Oracle and stuff it into an Excel
> spreadsheet. What modules have you used to interface with Excel and
> would you recommend it?

What does one use to bind Microsoft libraries to Python?
I think it would be "win32com" and I confess to not having used it.

Best bet would be to use Microsofts ADODB library together with Excels own
CopyFromRecordset function. Using ADODB, you can easily create a connection
to an Oracle server.  You would use this to stuff an ADODB.Recordset object
with query results.  Once you have your recordset stuffed with query results
you can pass it to the Excel "CopyFromRecordset" function:

    Worksheets("Whatever").Cells(1,1).CopyFromRecordset  {recordset object}

and wham!  - You have it in a table on a worksheet.

Thomas Bartkus







More information about the Python-list mailing list