Win32 and Excel ranges

Paul.Casteels at ua.ac.be Paul.Casteels at ua.ac.be
Fri Oct 18 02:37:56 EDT 2002


L Whitley <ldwhitley at removeme.charter.net> wrote:
: I've been going through Mark Hammond's book doing his Python/Excel examples.
: It's working nicely but I'm dissapointed with the performance of storing a
: lot of data in the spread sheet cell by cell.  My data is in lists and I
: would think that I would be reasonable to use ranges deliver the data to
: Excel.  I've found examples of how to read data from Excel using range, but
: haven't found an example of how to write data to Excel using range.  Can
: anyone help?

: Larry

This is something that works for me (using NumPy for the arrays) :

  xlApp = Dispatch("Excel.Application")
  xlApp.Workbooks.Add()
  xSheet = xlApp.ActiveWorkbook.ActiveSheet
  xSheet.Range(xSheet.Cells(row,col), \
    xSheet.Cells(row+aLen-1,col+1)).Value = array

My array is 2*8196 and the speed of this 1 line is also very low.
Does someone have other suggestions for speeding this up ?

	Paul Casteels



More information about the Python-list mailing list