This quickstart creates a Google Forms Editor add-on that uses triggers to send an email when a user responds to the form.
Objectives
- Set up the script.
- Run the script.
Prerequisites
To use this sample, you need the following prerequisites:
- A Google Account (Google Workspace accounts might require administrator approval).
- A web browser with access to the internet.
Set up the script
- Create a Google Forms form at forms.new.
- Click More > Script editor.
- Click Untitled project.
- Rename the Apps Script project Forms notifications and click Rename.
- Click Add a file > HTML. Name the file
sidebar
. - Repeat step 5 to create 4 more HTML files named
about
,authorizationEmail
,creatorNotification
, andrespondentNotification
. When you're done you should have 1 script file and 5 HTML files. Replace the contents of each file with the following corresponding code, then click Save .
code.gs
sidebar.html
about.html
authorizationEmail.html
creatorNotification.html
respondentNotification.html
Run the script
- Switch back to your form and refresh the page.
- Add a short answer text question to your form. In Untitled question, enter Email Address. Optionally, you can create other form questions.
- Click add-ons > Form notifications. It might take several seconds for add-ons to appear.
- In the dialog, click Configure notifications.
- When prompted, authorize the add-on.
- Again, click add-ons > Form notifications > Configure notifications.
- In the add-on, check the Notify me box and enter your email address.
- For Send notifications after every, enter 1.
- Click Save.
- To submit a response, click Preview
- Fill out the form and click Submit.
- Check your email for a notification.