Answer the question
In order to leave comments, you need to log in
How to bypass the script execution limit of 6 minutes?
Here is a piece of code.
do{
var fio = sheet.getRange(7+i, 8).getValue()
var data = sheet.getRange(7+i, 1).getValue()
var vremya = sheet.getRange(7+i, 2).getValue()
var zakazchik = sheet.getRange(7+i, 3).getValue()
var adres = sheet.getRange(7+i, 5).getValue()
var dom = sheet.getRange(7+i, 6).getValue()
var avto = sheet.getRange(7+i, 7).getValue()
var prinyal = sheet.getRange(7+i, 11).getValue()
var formaop = sheet.getRange(7+i, 12).getValue()
var sdal = sheet.getRange(7+i, 13).getValue()
var status = sheet.getRange(7+i, 14).getValue()
if(status == && formaop != ){
zp.getRange(2+j, 1).setValue(fio)
zp.getRange(2+j, 2).setValue(data)
zp.getRange(2+j, 3).setValue(vremya)
zp.getRange(2+j, 4).setValue(zakazchik)
zp.getRange(2+j, 5).setValue(adres)
zp.getRange(2+j, 6).setValue(dom)
zp.getRange(2+j, 7).setValue(avto)
zp.getRange(2+j, 8).setValue(formaop)
zp.getRange(2+j, 9).setValue(prinyal)
zp.getRange(2+j, 10).setValue(sdal)
j++
}
i++
}
while(data != "")
Answer the question
In order to leave comments, you need to log in
Optimize code!
On each access to the table, you lose a lot of time getRange , getValue , setValue ... It's
best to get all the data once, process it and put it back into the table once, if the data allows it, of course.
In short:
Try to minimize the number of table/sheet accesses.
---
Maxim Stoyanov (stomaks), developer of Google Apps Script .
g-apps-script.com
stomaks.me
Wow, that's too fat.
The data must be retrieved all at once , using range.getValues() The
result is a two-dimensional array accessed data[row][column] (numbered from 0)
Add rows
let maxRows = sheet.getMaxRows();
let maxColumns = sheet.getMaxColumns();
let data = sheet.getRange(1, 1, maxRows, maxColumns).getValues();
sheet\.getRange\(\s*(.*?)\s*,\s*(.*?)\s*\)\.getValue\(\)
inData[$1][$2]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question