I am new to AHK and I made a little script that reads an excelsheet row by row. But the performance is very bad. It takes 39 seconds to get a result
that is on row 2190. The 39 seconds is with closed excelsheet. When the file opend, it takes 14 seconds is also to long.
Is there a way to get the result faster? Who will help me out? Thanks in advance!
Code: Select all
^m::
LookForDate := "10.04.2022"
LookForName := "Name bla bla (UK) N+G"
LookForHours :=
FilePath := A_Desktop "\Uren Uitzendkrachten\Alle UKs 01.01.2022 t-m 14.05.2022.xls"
oWorkbook := ComObjGet(FilePath)
i = 2
loop
{
FoundName := oWorkbook.Sheets(1).Range("A"i).Text
FoundDate := oWorkbook.Sheets(1).Range("D"i).Text
FoundHours := oWorkbook.Sheets(1).Range("F"i).Text
if (FoundName = LookForName AND FoundDate = LookForDate)
{
MsgBox De gewerkte uren van: %FoundName% in Week %FoundDate% = %FoundHours%
break
}
i++
}
Xl.Quit() ; closes the excel object