Coding level: Beginner
Duration: 15 minutes
Project type: Automation with a custom menu and
an event-driven trigger
Objectives
- Understand what the solution does.
- Understand what the Apps Script services do within the solution.
- Set up the script.
- Run the script.
About this solution
Automatically create draft email replies to feedback from Google Forms. This solution focuses on course feedback from students, but you can apply it to any use case for which you receive feedback via Google Forms.
How it works
The script installs an event-driven trigger that runs each time a user submits a form. With each form submission, the script creates an email draft in Gmail. The email is addressed to the person who submitted the form and includes the form responses and a generic thank-you message. You can edit the email before you send it.
Apps Script services
This solution uses the following services:
- Script service–Installs the event-driven trigger that fires when someone submits a form.
- Spreadsheet service–Sends the form responses to Gmail.
- Gmail service–Creates the email draft with the thank-you message and form responses.
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
Click the following button to make a copy of the Respond to feedback sample
spreadsheet. The Apps Script project for this
solution is attached to the spreadsheet.
Make a copy
Run the script
- Click Form reply tool > Enable auto draft replies. You might need to refresh the page for this custom menu to appear.
When prompted, authorize the script. If the OAuth consent screen displays the warning, This app isn't verified, continue by selecting Advanced > Go to {Project Name} (unsafe).
Click Form reply tool > Enable auto draft replies again.
Click Tools > Manage form > Go to live form.
Fill out the form and click Submit.
Open Gmail and check your drafts. You should have a new draft with the form response.
Review the code
To review the Apps Script code for this solution, click View source code below:
View source code
Code.gs
Contributors
This sample was created by Ben Collins, Educator at benlcollins.com and Google Developer Expert.
- Find Ben on Twitter @benlcollins.
- Read Ben's blog.
This sample is maintained by Google with the help of Google Developer Experts.