0

I made a function in a google spreadsheet and it worked well until now.

The error sign popped up saying

Exception: Service invoked too many times for one day: urlfetch.

function player(id){

    var url = "https://shashanks.ga/node/getPlayers?playerID="+id;
    var response = UrlFetchApp.fetch(url)
    response = JSON.parse(response)
    var name = response.name;
    var townhall = response.townHallLevel;
    
    var data = [name,townhall];
  
    return data;
}

This is my script. What should I do?

NightEye
  • 10,634
  • 2
  • 5
  • 24

1 Answers1

0

There is a quota per day for urlFetchApp.fetch commands.

enter image description here

Make sure not to go beyond that quota as it will cause failures. It will reset the next day, so you can wait for that to happen.

The reason why you reach the quota is that your calls might be re-fetching the result multiple times. You might need to cache your data like the answer here

NightEye
  • 10,634
  • 2
  • 5
  • 24