win32com and MS Excel

Rony rony.steelandt at bucodi.com
Mon Feb 18 09:11:27 EST 2002


Jimmy,

Seems that you are quit good with activex stuff.
There is another thread here called Activex where 2 users has the same problem
(one of them is me :)
Could you have a look at this please 

Just to let you save some time:
I use activestate py 2.1
i generated the makepy file
the active works with severall other languages...

Thanks


"Jimmy Retzlaff" <jimmy at retzlaff.com> wrote in message news:<mailman.1013886806.19234.python-list at python.org>...
> >from win32com.client import Dispatch
> >ll = [['aaa', 333, 'ccc']] * 1000
> >xlApp = Dispatch("Excel.Application")
> >xlApp.Visible = 1
> >xlApp.Workbooks.Add()
> >t = xlApp.Workbooks(1).Sheets(1)
> >t.Range(t.Cells(1,1), t.Cells(len(ll),3)).Value = ll
>  
> >but with 50000 elements you'll have to wait some minutes for
> >Excel to show the data. And with 100000, I get a fatal error. 
> 
> If you haven't already, you can get quite a speed boost by running
> Makepy on the Excel type library. In PythonWin, select "COM Makepy
> utility" on the Tools menu and look for Microsoft Excel. The example
> above with 50,000 takes about 1 second on my 850MHz notebook. The Python
> file that makepy generates can also be quite valuable in figuring out
> Python/Excel nuances. You don't need to do anything in your code with
> that file, its mere existence speeds things up considerably (especially
> if you make a large number of calls into Excel).
> 
> The reason for the error with 100,000 is that Excel only supports 256
> columns and 65536 rows per spreadsheet.
> 
> Jimmy



More information about the Python-list mailing list