Ask Your Question
0

What is the method to use HTTP GET or POST to call google apps script?

asked 2023-07-15 09:19:49 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-07-15 09:26:01 +0000

nofretete gravatar image

To call a Google Apps Script using HTTP GET or POST requests, you need to publish your script as a web app. Here are the steps:

  1. Open your script in the Scripts Editor.
  2. Click on the "Publish" menu and select "Deploy as web app".
  3. In the "Deploy as web app" dialog, set access to "Anyone, even anonymous".
  4. Choose the version and submit the dialog.
  5. Note the deployed web app URL that is displayed.

To call the script using HTTP GET or POST, use the deployed web app URL with the appropriate HTTP method. For example, if your web app URL is "https://script.google.com/macros/s/<some-id>/exec", you can call it using:</some-id>

In your Apps Script code, you can access the GET or POST parameters using the event object. For example:

function doGet(event) {
  var param1 = event.parameter["key1"];
  var param2 = event.parameter["key2"];
  // process the parameters...
}

function doPost(event) {
  // process the POST data...
}
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-15 09:19:49 +0000

Seen: 11 times

Last updated: Jul 15 '23