How to Send Email Based on Response in Google Forms

Google Forms allows you to collect answers and opinions from respondents in a variety of ways, whether it’s a simple quiz or a lengthy question. While there are some handy native features, Google Forms doesn’t yet allow you to send email notifications to yourself or your respondents organically.

How to send email based on response in Google Forms

The latter comes if you want to thank the user for their feedback and time. On the other hand, if your form caters to a wide audience and has many departments involved, it will take a long time to sift through all the responses in the form.

Thankfully, there are a few workarounds that you can email the owner or individual. Now, there are two ways to proceed with this.

You can send an email based on any response on your form. Or, you can submit one depending on the answer the user has selected. And as noted earlier, both methods require the help of an external add-on. Since you will be sending an email from your account, you need to provide the relevant permissions for the add-on or functionality.

Now that we’re done, let’s get started, shall we?

How to send a general email using Google Forms

Thankfully, sending a generic email to a user or owner is not rocket science. The appropriately named Form Notifications add-on allows you to send simple thank you emails to users.

Step 1: Once you have created the form, click on the three-dot menu on the right and select Widgets from the list. This will take you to Google Marketplace.

How to send email based on response in Google Forms 2

Step 2: Now, search for Form Notifications and click on it to install.

Next, create the form. If you want to email respondents directly, select the Collect email check box in Settings.

How to send email based on response in Google Forms 3

Or else you can ask an email question from the user and mark it as Required as shown below.

How to send email based on response in Google Forms 4

Step 3: Once done, click on the small Add-on icon and select Form Notifications. You will see a prompt in the lower right corner.

See more:  7 Ways to Get Help in Windows 10 and Windows 11

How to send email based on response in Google Forms 5

Switch button for Thank you email.

How to send email based on response in Google Forms 6

As noted earlier, you can use the Auto field or the Form field. Choose the one that suits your requirements best. You can also add a Bcc to an email by filling in the ‘Send a copy to’ field.

Step 4: Next, add the Subject and Body of the email, and that’s it! Save the settings and click the Preview icon at the top to see if the current configuration works for you.

How to send email based on response in Google Forms 7

This is a simple add-on and configuring it is simple and straightforward. And the Published by Google Cloud tag also makes it trustworthy.

In addition to the above, you can also send an email to yourself (or to the creator) when the form reaches a fixed number of responses.

To do so, enable the ‘Notify on Form Response’ button. The creator’s email will be automatically populated in the recipient field. It is not hardcoded and you can also enter other email addresses.

How to send email based on response in Google Forms 1

Once done, add a notification threshold and hit the Save button. From now on, your form will send an email once it passes the response threshold.

How to send feedback based on feedback

Let us put it right there. If you want to submit feedback based on answers on your form, it’s not as easy as the process above. Here you will have to revise the Connected Spreadsheets Application Script.

Thankfully, if you have a simple form, it should be easy to do. In our case, we have a simple form where we ask respondents about their favorite vacation spot.

2 How to send email based on response in Google Forms 89

And depending on the answer they provide on the form, an email will be triggered to a set email address. Naturally, the code can be tailored to the requirements of your form.

Step 1: Once your form is created, click on the Feedback tab and tap the small Spreadsheet icon on the right. This will connect your form to a spreadsheet.

2 How to send email based on response in Google Forms 3

Step 2: Go to the spreadsheet and click Tools > Script Editor.

How to send email based on response in Google Forms 4

On the Script editor, paste the following lines of code,

See more:  How to Fix 403 Forbidden on Omegle

function check Location(e) { var subject = “”; var value = e.namedValues; var prefLocation=””; for (Enter value) { var label = Key; var data = value[Key]; prefLocation=data; Logger.log(data); } }

This e is the event that will be fired when the form is submitted, while e.namedValues the object will bring the form data to you as an array.

After that data is recorded, the For statement will cycle through the array to bring the data to you. Finally, the form data for that particular response will be assigned to prefLocation Change.

Step 3: Meanwhile, click on the little clock icon on the left panel to access Triggers and select Add Triggers.

How to send email based on response in Google Forms 6

Here, select From Spreadsheet as Event Source and Submit on Form as Event Type.

2 How to send email based on response in Google Forms 7

The above will ensure that the function we wrote above will be fired only when the form is submitted. And when sending, it will only pull data from the connected spreadsheet.

Step 4: Now go back to Script Editor to modify the code as per your requirement.

In our case, we want an email to be directed to a specific email ID when the respondent replies to Hills etc.

So we added a simple If and Else-If condition to the code,

function check Location(e) { var subject = “”; var value = e.namedValues; var prefLocation=””; for (Enter value) { var label = Key; var data = value[Key]; prefLocation=data; Logger.log(data); if (prefLocation==”Hills”){ subject=”You have an email for Hills Location”; GmailApp.sendEmail(‘[email protected]’, subject, prefLocation); }else if (prefLocation==”Beach”){ subject=”You have an email for Beach Location”; GmailApp.sendEmail(‘[email protected]’, subject, prefLocation); } else if(prefLocation==”City”) { subject=”You have an email for City Location”; GmailApp.sendEmail(‘[email protected]’, subject, prefLocation); } } }

Naturally, you will have to give permission to GmailApp.sendEmailI function to work. It’s a one-time process though.

Step 5: Now that everything is ready, save your code by clicking on the Save icon as shown below.

2 How to Send Email Based on Feedback in Google Forms 29

Now run the code. Unfortunately, without events, you won’t be able to run the code directly from the Script Editor.

To run your code, submit your form. If everything is in place, chances are high that you will receive an email.

Once done, you can edit the code to your requirements and add individual If-Else conditions. At the same time, you can also compose email content according to data.

See more:  MS Excel Name Manager: How to Create, Use, Manage Names

How to check for errors

It’s very rare to run code without errors on the first run, and honestly, there’s a lot that can go wrong. To check for errors, go to the Execution tab and you will see all instances where the function was called.

2 How to send email based on response in Google Forms 9

Click here to see the errors. Here you can also see how the function was called. The Trigger tag means form submission, while the Editor tag means the function was run through the Editor.

Also, if you want to cross-check the function’s value, just add Logger.log(variable) to log the data.

How to send email based on response in Google Forms 2

For instance, we called Logger.log(prefLocation) inside individual If-Else conditions, and our log looks like the one above.

To code or not to code?

The second method can look a bit complicated. But once you get the hang of calling individual functions, the odds get a little easier.

But at the end of the day, if you don’t want to get your hands dirty, you can check out the Email Notification Forms add-on. This one is designed to send emails based on conditional responses. However, the Conditional Formatting feature is not free and costs about $4 per month for a single user license.

So, if you need to submit a response for your form from time to time, you can paste the code above into the App Script editor.

Categories: How to
Source: thpttranhungdao.edu.vn/en/

Rate this post

Leave a Comment