Google Docs API as Google Apps Script "Advanced Google Service" - google-apps-script

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.

Related

Can anything done with google apps scripts be done with the google API?

I noticed that the Google Apps Script editor uses a Bearer token to make requests for a lot of things, that got me thinking: Is it possible to do all functions that are done with the google apps script with the google API on your own server? What is the essential difference? Just the fact that google apps script runs on google servers, while with the google API you would need to create your own servers?
For example many of the document functions, which I thought could only be done with the API, turns out can be found here https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertInlineImageRequest
so whats the essential difference?
Just the fact that google apps script runs on google servers, while with the google API you would need to create your own servers?
Yes. There are advantages to both methods:
API:
It's a rest API. You can use your own language(eg: Python) in your servers.
The api is more inclusive. There are stuff which can be done with the api, which cannot be accomplished with apps script.
User can set limited scopes for using API.
For example, at Drive API, https://www.googleapis.com/auth/drive.file can be used for Drive API. The same cannot be done with DriveApp of apps script.
Process cost of API is lower than that of the built-in methods for Google Apps Script1 2
Apps script:
No server on your side
Triggers. You can set up functions to run onEdit,onOpen or at a specific time.
Deep integration with Google apps: Sidebars/modal dialogs can only be done with apps script.
All methods of the api can be accessed indirectly through the bearer token.
Authorization/authentication is taken care of by apps script. You don't need to set up oauth.

How to capture/view Google App Script usage in Google API Console

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.

Buying more quota in GCP for Google Apps Script quota

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.

what is the SLA for Google App script?

I am new to Google App scripts and I have a few questions (I've done the diligent of going thru the FAQs) that I couldn't find answers yet
I read that Google App scripts are hosted in Google Drive. Where does it actually get executed?
are there any SLA or availability figures for the Google App scripts hosting environment?
can I host the Google App scripts (we will mainly use these as Gadgets for Google Site) on other environment? such as App engine?
many thanks
I've never seen anything official that answer these questions. So the following answers are just from my experience of working with Apps Script and as a Top Contributor.
It gets executed on Google servers, under the "script" subdomain at google.com. There's no info regarding the infrastructure.
There's no SLA. AFAIK it is not even covered in Google support for "Google for Work" (new name of Apps for Business)
No, you cannot host it anywhere else. And also not embed it anywhere expect a Google Site.
Preface
First of all, Google Apps Script seems to be separate from Google Sheets/Docs/Forms/Drive as noted in HIPAA Included Functionality:
As of July 21, 2020, The following functionality is Included Functionality under the applicable HIPAA Business Associate Addendum:
Gmail, Calendar, Drive (including Docs, Sheets, Slides, and Forms), Apps Script, Keep, Sites, Jamboard, Hangouts (chat messaging feature only), Google Chat, Google Meet, Google Voice (managed users only), Google Cloud Search, Cloud Identity Management, Google Groups, Google Tasks and Vault (if applicable).
So, in official docs, Google recognises Apps Script as separate service, as seen in Google Workspace HIPAA Included Functionality terms.
Is there SLA for Apps Script
There is Google Workspace Service Level Agreement (SLA, which is a matter of question), where Apps Script is NOT included in covered services.
From Google Workspace Service Level Agreement
Last modified: July 12, 2021:
"Google Workspace Covered Services" means the Gmail, Currents, Google Calendar, Google Cloud Print, Google Cloud Search, Google Docs, Google Sheets, Google Slides, Google Forms, Google Drive, Google Groups for Business, Google Hangouts messaging and video initiation, Google Chat, Google Meet, Google Keep, Google Sites, Google Jamboard, Google Tasks, Google Vault, and Google Voice components of the Service. This does not include the Gmail Labs functionality, and Google Jamboard Hardware components of the Service.
There is also additional Google Apps Script Additional Terms which have no mention of SLA (as of January 2022).
It's not should be considered any kind of legal advice, but looks like there is no explicit Apps Script SLA.

Use Adwords API (MccApp) in Google Apps Script

I have a custom API written in GAS (Google Apps Script) and would like to utilize the Adwords API from within it.
Sometimes used along with the MccApp, the service is readily available from within Adwords Scripts itself (My Client Center > Scripts).
For Example:
function account(client) {
var result = {
'id': null,
'campaigns': {}
}
result.id = client.getCustomerId()
var currentAct = AdWordsApp.currentAccount()
MccApp.select(client)
var campaignIterator = AdWordsApp.campaigns().get()
while (campaignIterator.hasNext()) {
var campaign = campaignIterator.next()
result.campaigns[campaign.getName()] = campaign.getId()
}
MccApp.select(currentAct)
return result
}
However, this API is not readily available inside a Google Apps Script. I have tried enabling it under "Resources > Advanced Google Services" and also under the developer console, but the UI offers no option that I can see.
QUESTION: Is it possible to enable use of the AdwordsApp and MccApp inside a Google Apps script so that the above code snippet would work in GAS?
If not, I understand already there are two workarounds:
Just use Adwords Script
Communicate with the API from GAS as though it were an external service (i.e... using SOAP, REST, etc...)
After much research, there really is no way to add the MccApp and AdwordsApp services for use in a Google Apps script. The nearest solution is to communicate with the API as though it were external or just use an Adwords Script.
It looks like you might be able to get to the AdWord API through the Management API:
See the Conceptual Overview section:
AdWords Links can be constructed at the Web Property level.
Google Developer Guide - What Is The Management API - Overview
and you can get to the Management API with the Google Analytics API.
Quote:
The Analytics service allows you to use the Google Analytics
Management API and Reporting APIs in Apps Script
Google Documentation - Google Analytics API
So, you need to use the RESOURCES menu, Choose, ADVANCED GOOGLE SERVICES, and then turn the Google Analytics API on.
With the Google Analytics API, you can access the Management API.