Google Forms allows you to collect responses and opinions from your respondents in a variety of ways, whether it’s a simple quiz or a long survey. Although it has a few useful native features, Google Forms doesn’t yet allow you to send email notifications to yourself or the respondent locally.
If you want to thank the user for their response and time, the latter comes into the picture. On the other hand, if your form appeals to a large audience and there are several departments involved, reviewing all form responses is time-consuming.
Fortunately, there are several workarounds that you can email the owner or individuals. Now, there are two ways to go with this.
You can send an email based on any response in your form. Or you can post one based on the answers users choose. And as mentioned earlier, both methods need the help of an external plugin. Since you will be pulling an email from your account, you need to provide the relevant permissions for the plugin or function.
Now that we’ve taken care of everything, let’s get started, shall we?
How to Send a Generic Email Using Google Forms
Sending a generic email to the user or owner isn’t rocket science, thankfully. The aptly named Form Notifications plugin lets you send simple thank-you emails to users.
Stage 1: After creating the form, click on the three-dot menu on the right and select Add-ons from the list. This will take you to the Google Marketplace.
Step 2: Now, search for Form Notifications and click on it to install.
Next, create the form. If you want to send emails directly to the respondent, check the Collect emails checkbox under Settings.
Or you can set up a form question asking the user for the email and mark it as Required as shown below.
Stage 3: Once done, click on the little Plugin icon and select Form Notifications. You will see a prompt in the lower right corner.
Change the button for a thank you email.
As mentioned earlier, you can go with the Automatically field or the Form field. Choose the one that best suits your needs. You can also add a Bcc for the email by filling in the ‘Send a copy’ field.
Step 4: Then add the Subject and Body of the email and that’s it! Save the settings and click on the Preview icon at the top to see if the current configurations work for you.
This is a simple plugin and its configuration is simple and straightforward. The Published by Google Cloud tag also makes it somewhat credible.
Apart from the above, you can also send yourself (or the creator) an email when the form receives a fixed number of responses.
To do this, toggle the ‘Report in form response’ button. The creator’s email will be auto-filled in the recipient field. It is not hardcoded and you can enter other email addresses as well.
Once done, add the notification threshold and hit the Save button. From now on, your form will send an email when it exceeds the response threshold.
How to Submit Responses Based on Responses
Let’s put it right there. If you want to submit response based on responses in your form, it’s not as easy as above process. Here you will have to fiddle with the Application Script of the linked Spreadsheet.
Fortunately, if you have a simple form, it should be easily doable. In our case, we have a simple form where we ask respondents their preferred resort.
And based on their response on the form, an email will be triggered to a specific email address. Naturally, the code can be modified according to your form’s requirement.
Stage 1: Once your form is created, click on the Responses tab and tap on the small Spreadsheet icon on the right. This will link your form to a spreadsheet.
Step 2: Go to the spreadsheet and click Tools > Script Editor.
Paste the following lines of code in the Script editor,
function checkLocation(e) { var subject=""; var values = e.namedValues; var prefLocation=""; for (Key in values) { var label = Key; var data = values[Key]; prefLocation=data; Logger.log(data); } }
Here to is the event that will be triggered when the form is submitted, e.namedValues It will bring you the object form data in the form of an array.
Once this data is captured, the For statement will loop through the array to fetch you the data. Finally, the form data for that particular response, preposition variable.
Stage 3: Meanwhile, to access Triggers, click on the little clock icon on the left panel and select Add Trigger.
Here, select From Spreadsheet as the Event Source and Form Submission as the Event Type.
The above will ensure that the function we wrote above will only be triggered when the form is submitted. And when submitted, it will only pull data from the linked spreadsheet.
Step 4: Now, go back to the Script Editor to modify the code as per your need.
In our case, a respondent would go to Hills etc. we want an email to be sent to a specific email id when it responds.
So we added a simple If and Else-If condition to the code,
function checkLocation(e) { var subject=""; var values = e.namedValues; var prefLocation=""; for (Key in values) { var label = Key; var data = values[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=="Beaches"){ subject="You have an email for Beaches Location"; GmailApp.sendEmail('[email protected]', subject, prefLocation); } else if(prefLocation=="Cities") { subject="You have an email for Cities Location"; GmailApp.sendEmail('[email protected]', subject, prefLocation); } } }
Naturally, you will need to allow GmailApp.sendEmaiI work to work. It’s a one-time process though.
Step 5: Now that everything is in place, save your code by clicking the Save icon as shown below.
Now run the code. Unfortunately, in the absence of an event, you cannot run the code directly from the Script Editor.
Submit your form to run your code. If everything is in the right place, you will most likely receive an email.
Once complete, you can modify the code as per your need and add individual If-Else conditions. You can also design the body of the email based on the data.
How to Check for Errors
It’s rare to run error-free code the first time, and to be honest, there are a lot of things that can go wrong. To check for the error go to the Executions tab and you will see all instances where the function was called.
Click to see the errors. Here you can also see how the function is called. Trigger tag converts to form submission while Editor tag means the function is run via Editor.
Also, if you want to cross-check the value of the function, simply add Logger.log(variable) to log the data.
For example, we called Logger.log(prefLocation) within individual If-Else conditions and our log looked like the one above.
To Code or Not to Code
The second method may seem a bit complicated. However, once you understand how individual functions are called, things will likely get a little easier.
But if you don’t want to get your hands dirty at the end of the day, you can check out the Email Notification Forms plugin. This is designed for sending email based on conditional responses. However, the Conditional Formatting feature is not free and costs around $4 per month for a single user license.
So, if you need to occasionally submit responses for your forms, you can paste the above code into the Application Script editor.