Send curated content

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.

Demo of sending content with Google Forms and Gmail

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

Try it

Step 1: Set up the spreadsheet

  1. Click the button below to make a copy of the Send curated content spreadsheet.
    Make a copy
  2. Click Extensions > Apps Script.
  3. In the function dropdown, select installTrigger.
  4. Click Run.
  5. When prompted, click Review permissions and authorize the script.

Step 2: Send the content

  1. Switch back to the spreadsheet and click Tools > Manage form > Go to live form.
  2. Fill out the form and click Submit.
  3. 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.

Contributors

This sample is maintained by Google with the help of Google Developer Experts.