Call an App script library from another web site

Viewed 29

Good morning,

I have some functions to modify a google sheet file (with Apps Script) and I want to call them from my site, basically, I want to click on a form to send me to an excel sheet with some specific data (with a function already created), and I have no possibility to create or modify an existing database, it is a very closed environment (Zendesk).

I don't know how to implement it on a web that is not made with google services.

Thanks for your help.

1 Answers

The easier way to call a Google Apps Script function from an external app is by creating a web app using Google Apps Script, set to be executed as the owner.

I.E. the following is the code for a web app that call myFunction and return a string as response when is called by a HTTP GET request.

function doGet(){
  myFunction();
  return ContentService.createTextOutput('Put here your response');
}

You should make a web application deployment, set as be executed as you by anyone even anonymous. Then make the HTTP GET request by using the web application URL.

Instead of doGet you might use doPost to make your web app respond to HTTP POST requests. Also, you might use different settings, but you should provide the proper OAuth token.

For further details please read https://developers.google.com/apps-script/guides/web

Another option is to use the Google Apps Script API but this might require from to invest more time.

Related