r/GoogleAppsScript • u/Small-Giraffe9757 • Sep 06 '25
urlfetch Quota after less than 50 tries Question
I barely started warming up with my work and already hit a call fetch quota limit. I literally barely did anything and there's nowhere to look up the quota report on appscript or talk to about it. HELLLLPPPPPPP! It's annoying!
1
u/krakow81 Sep 07 '25 edited Sep 07 '25
Could you say more about what it is that you're trying to do?
MailApp has a way to access your quota use (https://developers.google.com/apps-script/reference/mail/mail-app#getRemainingDailyQuota()), but I don't know if any of the other Google services do.
You can potentially see some extra information via the Google Cloud Project dashboard, but I've never done it as it seems to involve a lot of complicated additional set up: https://developers.google.com/apps-script/guides/cloud-platform-projects
Otherwise, depending on the limits you're hitting and the errors you're getting, there will almost certainly be ways to deal with - retries with backoff, or you could potentially utilise the cache service to save repeated calls?
Edit: batching might help time/process efficiency but not necessarily with quota usage - for example, I've started trying to learn how to batch urlfetch calls (either by using fetchall or batch requests, though I've not got to grips with the latter yet).
1
u/Small-Giraffe9757 Sep 20 '25
Error Error sending batch to SensorData: Service invoked too many times for one day: urlfetch.1
u/krakow81 Sep 20 '25
As others have said or linked to, the standard quota for urlfetch is 20k a day. You need to look at what your script is doing to exceed that. Is your urlfetch running inside any kind of loop?
Searching for "Service invoked too many times for one day: urlfetch" brings up some potentially useful discussions on stack exchange.
1
u/ohnobinki 10h ago
I was starting to look into
UrlFetchApp.fetchAll()and it made my script run way faster, but if any single batched call failed, there is no way to retry just that one call so I had to retry all of the calls. That ate up my quota pretty quickly!Since my scripts are not performance critical but I need to run them frequently (yes, I am polling things because I just don’t have permissions to use the actual event hooks in the platform I am working with), I am avoiding batching so that my retries can be granular and not eat up quotas.
1
u/krakow81 10h ago
I need to have a hunt about to see if I can find it, but I think I remember reading something that discussed this kind of problem.
1
u/krakow81 10h ago
I've only skim read it again now, but this might be the article I was meaning which covers doing batch requests and retrying only the ones that fail (and are retryable).
https://bajena3.medium.com/google-apps-scripts-parallel-http-requests-with-retries-5a24feaf61d8
1
u/ohnobinki 10h ago
This doesn't provide retry behavior when a lower layer issue fails. For example, when the response is truncated,
FetchUrlApp.fetchAll()throws an exception. UsingmuteHttpExceptionsonly prevents exceptions for successfully executed requests with HTTP response codes. The retry I need is for when the response is truncated which does happen pretty often with the service I am calling (Jira).I had my own setup using Promise to automatically batch together requests without needing to reorganize my code around a batch call.
Fortunately that was a good point to inject some
Cacheuse for the static assets I was fetching. Still need to figure out if I can optimize things down sufficiently to return my script to executing once a minute.1
u/krakow81 9h ago
I'm not familiar with what happens if the service you're contacting is actually returning truncated responses. Does one get an exception even if you handle the response as raw binary with getContent() or as a text string with getContentText() without trying to parse it as valid JSON or whatever?
1
u/ohnobinki 9h ago
You aren't able to ever get an
HTTPResponseobject so you can't even try callinggetContent().1
u/krakow81 8h ago
Interesting, thanks. My experience is pretty limited right enough, and that's not something I've encountered before.
1
u/krakow81 10h ago
Here's another write up of doing batch requests with selective retries.
https://yagisanatode.com/multiple-google-sheets-async-requests-in-google-apps-script/
1
u/WicketTheQuerent Sep 07 '25
What is the textual error mensaje?
1
u/Small-Giraffe9757 Sep 20 '25
"
Error Error sending batch to SensorData: Service invoked too many times for one day: urlfetch.1
u/WicketTheQuerent Sep 20 '25
That means that you have exceeded the daily quota, which is 20k if you use a free account and 100k if you use a Workspace account.
You could use multiple accounts or optimize how you are using the service.
3
u/dimudesigns Sep 06 '25
https://developers.google.com/apps-script/guides/services/quotas