Hi,

I used OOoBasic, which is not really fast.
For the test my sheet had numbers on the first 637 rows, but the macro runs on 27001 rows.

Sub Main
Dim sh As Object, myCell As Object
Dim x As Long, y As Long, t As Long

sh = ThisComponent.Sheets(0)
t = GetSystemTicks
for y =  0 to 27000
  for x = 0 to 32
    myCell = sh.getCellByPosition(x,y)
  next
next
MsgBox("Duration : " & GetSystemTicks -t & " milliseconds")
End Sub

Result : approx. 110 seconds (less than 2 minutes)
Windows XP SP3, Intel Core 2CPU at 2.13 GHz

Your spreadsheet probably has something special. Or you do something else in the loop.
Try to load the csv version instead of the original Excel file.

Regards
  Bernard

Message de Andrew Pitonyak  date 2010-11-08 00:04 :

On Fri, 5 Nov 2010 21:24:08 -0400, Scott Deerwester
<scott.deerwes...@gmail.com>  wrote:
The following code (in Python):

for r in range(dataRange.StartRow, dataRange.EndRow):
     for c in range(dataRange.StartColumn, dataRange.EndColumn):
         cell = sheet.getCellByPosition(c,r)


takes nearly two hours to run on a reasonably fast workstation for a
spreadsheet with 32 columns and ~27,000 rows (about .2 seconds per row).
By
comparison, opening the file takes about 8 seconds and saving the file
to a
CSV (which is functionally equivalent to the above) takes a few seconds.
The
original file was written in Excel as an XLS (not XLSX). This seems
impossibly slow. Am I misusing the API somehow? What can I do to speed
it
up?



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org

Reply via email to