How to Show Different Text in Google Form Emails Based on the Answers
A condition shows part of your email message only when an answer has a certain value. Use it when one email template has to fit every response, but a sentence or a paragraph is meant for some respondents only.
To send a whole email only for some answers, use conditional notification emails instead.
Maya runs workshops at Willow Lane Studio. Her registration form has these questions, and the examples on this page use two responses:
| Question | Daniel’s answer | Sofia’s answer |
|---|---|---|
| Your name | Daniel Okafor | sofia marquez |
| Ticket type | VIP | Standard |
| Number of guests | 3 | 1 |
| Sessions | Pottery, Weaving | Weaving |
| Dietary needs | Vegetarian |
Add a Condition to the Email
Section titled “Add a Condition to the Email”Type the opening tag before the text that only some people should see, and the closing tag after it. The form field in the tag is the question title, the same as other dynamic form fields:
Hi {{Your name}},
{% if {{Ticket type}} == "VIP" %}Your VIP ticket includes lunch and a front-row seat.{% else %}Doors open at 9:30 AM.{% endif %}
{% if {{Number of guests}} > 2 %}Please bring a photo ID for each guest.{% endif %}Daniel reads Your VIP ticket includes lunch and a front-row seat and Please bring a photo ID for each guest. Sofia reads only Doors open at 9:30 AM.
Every {% if %} needs its own {% endif %}. Type the tags with straight quotes, and leave them as plain text: making part of a tag bold or coloured stops it from working.
Submit a test response after you add a condition, and check the email it sends.
Compare Answers
Section titled “Compare Answers”| You write | The text shows when |
|---|---|
{% if {{Ticket type}} == "VIP" %} |
The answer is VIP. Capital letters must match. |
{% if {{Ticket type}} != "VIP" %} |
The answer is anything else, or empty |
{% if {{Dietary needs}} != "" %} |
The question was answered |
{% if {{Dietary needs}} == "" %} |
The question was left empty |
{% if {{Number of guests}} > 2 %} |
The answer is a number above 2 |
{% if {{Sessions}} contains "Pottery" %} |
A checkbox answer includes that choice |
{% if {{Ticket type}} == "VIP" and {{Number of guests}} > 2 %} |
Both are true |
{% if {{Ticket type}} == "VIP" or {{Number of guests}} > 2 %} |
Either is true |
Text goes in quotes and numbers don’t.
To choose between more than two results, add {% elsif %}:
{% if {{Ticket type}} == "VIP" %}Collect your badge at the VIP desk.{% elsif {{Ticket type}} == "Standard" %}Collect your badge at the front desk.{% else %}We will email your badge.{% endif %}Change an Answer with a Filter
Section titled “Change an Answer with a Filter”A filter changes an answer before it goes into the email. Write the form field inside {? and ?}, then a | and the filter:
Sofia typed her name in small letters. This takes the first word of her answer and gives it a capital letter:
Hi {? {{Your name}} | split: " " | first | capitalize ?},| You write | Sofia gets | What it does |
|---|---|---|
{? {{Your name}} | upcase ?} |
SOFIA MARQUEZ |
Capital letters throughout |
{? {{Your name}} | capitalize ?} |
Sofia marquez |
A capital first letter, small letters after it |
{? {{Dietary needs}} | default: "None" ?} |
None |
Text to use when the answer is empty |
{? {{Number of guests}} | times: 20 ?} |
20 |
The number multiplied by 20 |
Filters can also do arithmetic, format dates and work on lists, and a loop can print one line for each ticked checkbox. The Scriptlets Reference lists every tag and filter with examples.
Where Conditions Work
Section titled “Where Conditions Work”Conditions and filters work in the email subject and message body, in the PDF template, and in the messages sent to Slack, Discord, Google Chat, SMS and phone push notifications.
They are not read in webhooks.
Things to Know
Section titled “Things to Know”- Capital letters and spaces count.
VIPdoes not matchvip. - A number with a comma, a currency sign or a unit is text.
1,200and3 guestscan’t be compared with>or<. - An empty answer is not “false”.
{% if {{Dietary needs}} %}is true for every response. Compare with""to check for an empty answer. - An answer is never read as a tag. If someone types
{% if %}into your form, the email shows that text. {% include %},{% render %}and{% layout %}are not available.
Troubleshooting
Section titled “Troubleshooting”The email shows the tags as typed
Section titled “The email shows the tags as typed”A tag has a mistake, so the email was sent with its form fields filled in and the tags left as they are. The most common causes:
- An
{% if %}has no{% endif %}after it. - The quotes in a tag are curly, like
“VIP”. Type them again as"VIP". - Part of a tag is in bold, in colour or linked. Select the tag and remove the formatting.
- There is a space between
{and%.
The condition is never true
Section titled “The condition is never true”Check these in order:
- Does the value in the quotes match the answer, with the same capital letters?
- Is the text in quotes, like
"VIP"? Without quotes, the condition is never true and no error is shown. - For
>or<, is the answer a plain number?
