Is it possible to call an external API via HTTP post/get?

443 views
Skip to first unread message

Johan Vanhopplinus

unread,
May 27, 2019, 2:29:11 AM5/27/19
to Google Apps Script Community
Hi,

Is it possible in a Google Form with the Apps Script to call an external API when you click on the submit button of the form? 
If so how do I have to proceed to be able to make this possible?

Thanks in advance

Alan Wells

unread,
May 27, 2019, 8:36:07 AM5/27/19
to Google Apps Script Community
Yes, it's possible.  An "On Form Submit" trigger needs to be installed.  The function that is associated with the submit event will run every time that the Form is submitted.  Both Forms and Sheets have "On Form Submit" trigger capability.

Here is a link to the event objects documentation:

Installable triggers

To make an HTTPS Request the script must be given permission to make an external request.  Use:

UrlFetchApp.fetch(url, options)

to make a request to the API.

The Form can not be modified when it's open in View mode.  You can't make an external request to an API, and then display something in the Form to the user.
Reply all
Reply to author
Forward
0 new messages