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?

Upvotes: 1

Views: 162

Answers (1)

TheMaster
TheMaster

Reputation: 50452

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.

Upvotes: 5

Related Questions