Coding level: Beginner
Duration: 20 minutes
Project type: Automation with an event-driven trigger
About this solution
If you have various types of content you'd like to offer your audience, you can let users choose what content they receive from you with Google Forms. This solution lets users select the topics they’re interested in, then automatically emails them their chosen content.
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 and sends an email from a Google Docs template. The email includes the user's name and the content they selected. The content you offer can be of any type as long as it’s referenced by a URL.
Apps Script services
This solution uses the following services:
- Script Service: Installs the event-driven trigger that fires whenever someone submits the form.
- Document Service: Opens the Docs template that the script uses to create the email.
- Mail Service: Creates and sends the email with the user’s name and content selection.
- Spreadsheet Service: Adds a confirmation to the Form responses sheet after the script sends the email.
Before you begin
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
Step 1: Set up the spreadsheet
- Click the button below to make a copy of the Send curated content
Make a copy
- Click Extensions > Apps Script.
- In the function dropdown, select installTrigger.
- Click Run.
- When prompted, authorize the script.
Step 2: Send the content
- Switch back to the spreadsheet and click Tools > Manage form > Go to live form.
- Fill out the form and click Submit.
- Check your email for an email with links to the content you selected.
Open the Apps Script project
The sample script's code includes in-line comments to help you understand how it works. To access the code, in the spreadsheet, click Extensions > Apps Script.
This sample is maintained by Google with the help of Google Developer Experts.