Google Cloud Vision API from Google Apps Script? - google-apps-script

I've been accessing the Google Cloud Vision API from a script in a Google Sheet using UrlFetch and the REST API.
Until I got "UrlFetch failed because too much upload bandwidth was used" I didn't even know there was a quota on UrlFetch!
Is the a way to access Google Cloud APIs from a Google Apps Script so I can dodge the quota?

Quotas protect the users of Google services by preventing unforeseen spikes in usage, on the benefit of both the user (who might get unexpected bills if the quota is related to a payed resource) and the community (who will have more resourcesa available, as they will not be monopolized by users that are making an excesive use of them).
That is the reason why quotas cannot be exceeded, although depending on the service (and specific quota) you are using, you may be able to request a quota increase by following the documented procedure or contacting the support team of the product in use.
Finally, in order to identify which is the quota that you are currently hitting, refer to this documentation page where you will be able to find the quotas for URL Fetch, which as of February 2018 are:
As a side note, you have to take into account that these quotas are refreshed at the end of a 24-hour window, so your quota will be resetted to 0 every day. Moreover, this is also on a per-user basis, so you can work around this limitation by spreading your URLFetch usage across several users and days, if that is something that you can manage.

Related

Bandwidth Quota for Google Apps Script

This morning we got a couple of errors from Google Apps script saying:
Exception: Bandwidth quota exceeded...
Try reducing the rate of data transfer.
Our Google Apps Script (GAS) programs mainly look at Gmail, do some processing, access Google Maps some, and transfer data back and forth between GAS/GCP and an app hosted on another platform.
However, accessing Gmail doesn't seem to be what this is talking about. "Bandwidth quota" would seem to indicate too much data is being transferred into and out of the Google servers via Google Apps Script. We do transfer a fair amount of data back and forth to an app hosted on another platform on the Internet, such as Amazon Web Services.
However, we don't see that there is a "Bandwidth quota" on the Google Services Quotas page. AND around the time we got this error this morning, we weren't accessing Gmail nor transferring data back and forth outside of GCP any more than usual. Probably less.
Does anyone know what this quota is, where we can find it, and how we can possibly bump it up, even if we need to pay for it?
I looked at our Google Cloud Platform (CCP) Console Quotas (https://console.cloud.google.com/iam-admin/quotas) and we are well below any usage limit, and see none that are about a "Bandwidth Quota".
Thank you!
UPDATE 29 March 2022 - After more than a month of having zero of these messages, this evening we are seeing at least 10 of them. Some facts:
The "bandwidth quota exceeded" errors are only happening when calling the APIs for one particular external app hosted on AWS-like servers. They do not occur when calling drive, maps, etc. or any other APIs.
Today has been a lower-volume day & evening for our app than many are. So, this makes no sense why we would get these errors this evening and not other days.

Can I pay to increase my Google App Scripts Quota Limits?

We have a very complex core banking system using MongoDB and Google Sheets, and we are hitting the Google Apps Script quota limits and getting timeouts daily. We are looking at optimizing where we can, but I need to know if there is a way that I can increase the limits somehow in the meantime (don't mind paying more).
I have looked at the Early Access Program, but it says that they aren't taking any more new members.
Any ways that I can increase the limits?
Yes, you can
If you have a look at the Apps Script Quota information, you will see that the limits depend on the type of account you have.
If you have a free account, it means that most likely it is a Customer Account.
You can upgrade to either G Suite Basic, G Suite Business or G Suite Enterprise - depending on how much you need to increase your quota and how much you are willing to pay.
See here for more information about different accounts and pricing.

Where to apply for more "URL Fetch calls" quota from google

I use URL fetch calls in Adwords scripts to scrape various sources, most of all my own web pages. I find myself limited by the quota of 20 000 requests/24hours. https://script.google.com/dashboard . Where can I apply for a larger quota?
I have substantially large Adwords accounts.
My account managers and Adwords support didn't know the answer and finally sent me to the Adwords API support team. Adwords API support sent me here to stackoverflow. Thanks for any input.
You may want to check this documentation which outlines various limits and limitations in AdWords scripts that you should be aware of. Also note that, Google Apps Script services impose daily quotas and hard limits on some features.
And as commented by #rckrd, to get a higher quota, you may want to sign up for G Suite. See this page for more information on quota limits for Google Services.

Is there a Google Apps Script quotas dashboard?

Does Google offer any type of dashboard which shows which scripts are using the most amount of computer time? I've been getting a lot of notices lately that I'm exceeding my computer time quota. I'm making adjustments where I can but it's difficult to know where I can tweak things without some type of dashboard showing me where my quota is being used.
There are a few ways to check quotas. Some of the service APIs may have methods (like MailApp's getRemainingDailyQuota). You can also check the Quotas page from your Developer's Console. Sometimes you get quota errors that are unclear but there is a reference page that clarifies some of them.

What are Google's Apps Script resource constraints?

I couldn't find this in the documentation. Ostensibly Google would terminate your script if it was consuming too many resources. Are there any guidelines on how to play nicely with Google's servers?
Have a look at the Apps Script Dashboard - especially under "Quota Limits." There are also rate limits that may limit the frequency of service calls in your projects.