The error:
Exception: Service invoked too many times in a short time: urlfetch. Try Utilities.sleep(1000) between calls.
the code:
const ss = clustersSheet;
const [header, ...data] = ss.getDataRange().getValues()
.filter(row => row != '' ? row : null);
var start = cachedSettings2Data[14][6];
while(start<=ss.getLastRow()){
const requests = data.slice(start,start+50).map(column => column[header.indexOf("Primary Keyword")])
.map(primary_keyword => `${baseUrl}${primary_keyword}${rest_of_query}`);
console.log(requests)
start = start+ requests.length;
const responses = UrlFetchApp.fetchAll(requests);
//up to here
const parsed_responses = responses.map(response => JSON.parse(response.getContentText()));
console.log(parsed_responses);
The error mentions "urlfetch" being invoked too many times, but to be clear I am only using fetchAll in my code. I managed a workaround by batching my data and doing batches of 50 requests, however I would like a way to do fetchall on high numbers of requests