Skip to content Skip to sidebar Skip to footer

Google Sheet Script - Multiple Getrange Looping

so I have a new problem. So far my script here can loop a sheet and find the text 'Bank', it will set the background color to red and it will take the value from another cell as ma

Solution 1:

You may look at similar questions:

Google Script - Internal Error after 15 seconds

Google script - Exceeded maximum execution time , help optimize

Google sheet script, times out. Need a new way or flip it upside down

Basic solution is to use getValues() one time and then loop values in 2d array:

var sheet = SpreadsheetApp.getActiveSheet(); 
var rows = sheet.getDataRange(); 
vardata = rows.getValues();

for (var i = 0; i < numRows; i++)
{
  var j = SomeValue; // column number - 1var row = data[i]; // row from origonal data rangevar value = row[j]; // value from data// some other code...   
} 

See more info about your problem here:

Your scripts will run faster if you can find ways to minimize the calls the scripts make to those services.

Post a Comment for "Google Sheet Script - Multiple Getrange Looping"