0

I created a Google App Script AAA and deployed it as "API Executable" that runs as me, and then created a second Google App Script BBB that runs as the user accessing the web app.

The goal is to get the user email using script BBB and then pass that as a parameter to AAA to generate a Google Drive folder with the email as the folder name.

I cannot get the syntax correct to execute the function in AAA from BBB.

I am only using Google App Script. Examples I found are with using Java, or Python, etc, but I would like to do with within the Google App Script.

2
  • 2
    Read How to Ask and minimal reproducible example. Provide minimal reproducible example Commented Mar 1, 2020 at 5:07
  • To call your Web App AAA, you must make an HTTPS Request from file BBB with UrlFetchApp(url) to the published url of the AAA Web App. Link to fetch documentation In file AAA you must have either a doGet() or doPost() function. Those are reserved function names that are simple triggers, or event handlers that watch for the GET or POST request being made to the url of the published web app, and then run if a request is detected. If you already have that then post your code. Commented Mar 1, 2020 at 13:02

1 Answer 1

1

In App BBB, pass the email address as a URL parameter to UrlFetchApp:

UrlFetchApp.fetch('http://address/of/appAAA?email=' + Session.getActiveUser().getEmail())

In App AAA, parse the email parameter within the doGet() function:

function doGet(e) {
  var email = e.parameter.email;
  // Do something with the email.
}

For more about the values passed to doGet() in the e Event object, see here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.