How can usage of Google App Script libraries like GmailApp, CalendarApp, and PropertiesService be tracked through the Google API Console?
While Google App Script projects do show up inside the API console, none of them show any activity when selected. I understand that individual Google APIs need to be enabled for a project in order for their usage to be visible in the API console, but none of the App Script APIs seem to be available in the list Google APIs to choose from.
My only guess is that Google App Script usage cannot in fact be tracked through the Google API Console, which is a shame since many users seem to hit their app script quota limits and would benefit from the ability to track and visualize their script's resource usage.
Yes, it is true that you cannot track the usage of individual libraries of Google App Script in the Google Developer Console except for the MailApp. The MailApp has a method of getRemainingDailyQuota() that returns the number of remaining emails a user can send for the rest of the day. You can check in this documentation the different quotas and limitations that you can do with the Apps script. I also suggest you to make a feature request about this issue.
Related
We make substantial use of Google Apps Script, and today I saw this error:
UrlFetch failed because too much upload bandwidth was used in Code (gci standalone script):219
I found lots of links to Google Apps Engine quotas, and how to check Apps Engine quota usage. However the Apps Engine quotas all showed as 0 in the Google Cloud developers console. This is not surprising since we don't use Apps Engine, but I was unable to find a similar breakdown for Google Apps Scripts.
Is there one?
On another note, this question: Are there quotas for incoming requests to a Web App?
has an answer:
urlFetch quotas do not apply unless you are making the call to the spreadsheets api v3 directly without spreadsheetApp.
We use UrlFetch to retrieve CouchDB data. I would like to monitor the amount of quota for this service that we use. Is there a way to do so?
You can call the quota for the send emails quota but don't think you can do it for urlfetch.
I know I can use the Google Docs API along with the UrlFetchApp service. But does anyone know if the Google Docs API will be available as an "Advanced Google Service" in Google Apps Script, if so, can you tell when this will happen?
I can't say for sure (I don't work at Google) but there are information channels you can monitor for news and product updates related to Google Apps Script and GSuite products:
Google Apps Script Release Notes
What's New in GSuite
GSuite Updates
Besides, "Advanced Services" are just wrappers for their respective APIs and their main purpose is to provide code completion. Under the hood, you consume the same resources as you would if you called the API directly via UrlFetch (this includes usage quotas).
If you're up to the task you can write your own implementation based on the discovery docs available for the Google Docs API.
We make substantial use of Google Apps Script, and today I saw this error:
UrlFetch failed because too much upload bandwidth was used in Code (gci standalone script):219
I found lots of links to Google Apps Engine quotas, and how to check Apps Engine quota usage. However the Apps Engine quotas all showed as 0 in the Google Cloud developers console. This is not surprising since we don't use Apps Engine, but I was unable to find a similar breakdown for Google Apps Scripts.
Is there one?
On another note, this question: Are there quotas for incoming requests to a Web App?
has an answer:
urlFetch quotas do not apply unless you are making the call to the spreadsheets api v3 directly without spreadsheetApp.
We use UrlFetch to retrieve CouchDB data. I would like to monitor the amount of quota for this service that we use. Is there a way to do so?
You can call the quota for the send emails quota but don't think you can do it for urlfetch.
I'm facing quota limits of sending mails via Google Apps Script. The limit is 100 a day. I called the support center, but they say the script is out of the scope of Google Apps Service.
They told me I could buy more quota at GCP (Google Cloud Platform), now my question: Do I have to code new scripts on the GCP, or can I somehow connect the Google Apps Script (which is part of Drive and Apps I guess) with GCP?
I'm not sure if you can link both projects, however, I think Apps script email service would still be limited by it's own quotas.
A possible workaround would be to call the Gmail API directly instead of using the Apps script Gmailapp service.
To call the API you can use the "UrlFetchApp.fetch()" to make the call to the Gmail send endpoint.
To be able to make the call to the Gmail API, you will have to enable it in the developer console, for this in your script go to "Resources -> Advanced Google Services". There you will enable the Gmail API, then you have to click on the link that says "These services must also be enabled in the Google Developers Console."
It will take you to the Developer Console of your Appscript project, there you also have to enable the Gmail API.
The quota for UrlFetch is 20k calls/day, so in this case you would be limited by this quota and the Gmail API quota.
I have an app that consists of two parts
an installed application (more specifically: a browser add-on) that runs on the user's machine, and
a web app implemented as a stand-alone Google Apps Script app using HtmlService.
The two parts talk to each other and both access some Google APIs on behalf of the user via Oauth. To do this, I set up an API project in the Google API console. In the section "API Access", I created a client of type "Installed Application" for the browser add-on. For the Apps Script part, Google takes care of the authorization flow automatically.
My problem is that Google does not know that these two clients are part of the same project. Therefore, the user has to go through two authorization steps in a row when executing my app for the first time (first, the Oauth process for the browser add-on and then the automatically generated authorization process from Google Apps Script). This is very confusing to the user, especially, since the splitting between the browser add-on and the web app is rather an implementational detail about which the user shouldn't really have to bother.
Is there a way to unify the two authorization flows? I know that one can add several distinct clients to a single project in the Google API console. It seems to me like this feature is explicitly intended for scenarios similar to mine, where more than one application make up what is perceived as a single service by the user. Unfortunately, web apps that are implemented in Google Apps script don't seem to be compatible with the Google API console because of the way Apps Script generates the authorization flow automatically. Or am I missing an option in the API console or in the Apps Script editor?
For future reference: I found out that Google automatically creates an API project in the Google API console for each Google Apps Script project. This seems to be a fairly recent feature. One difficulty for me was that these API projects don't show up when one goes to the API console, clicks on the name of whatever project is currently opened in the upper left corner and chooses "open". Apparently, the only way to reach the auto-generated API project is as follows:
Go to drive.google.com and open the Google Apps Script project.
Chose "Resources --> Use Google APIs...".
In the popup, click the link to the Google API console.
In principle, this should allow to add additional clients to the project, as long as none of the other clients is also a Google Apps Script project. I haven't been able to test this since it still doesn't solve my specific problem: Sending e-mails from the user's Gmail account seems to be a feature unique to Google Apps Script and I couldn't find an Oauth2 scope for this operation. Therefore, I still cannot ask for all required permissions in a single authorization flow. But if anyone who's reading this has a similar problem with different Oauth2 scopes, the above instructions should fix it for you.
Anyway, I solved my problem in the meantime by no longer using Google Drive to upload files.