Introduction

Google Forms is an excellent tool for collecting information, but did you know you can automate email confirmations to respondents, transforming it into a powerful communication tool?

With Google Apps Script (GAS), you can set up automatic email responses, ensuring each submission is promptly acknowledged.

This article will guide you through the process of creating a simple script to automate email confirmations from Google Forms.

The sample codes provided in this article are just starting points to show you what is possible with GAS. We recommend that you dive deeper into the capabilities of GAS to fully leverage its potential and customise scripts to suit your specific needs.

If you are a complete beginner to Google Apps Script, we recommend to take a read on our Beginner’s Guide to Google Apps Script first before diving into this post.

Why Automate Email Confirmations?

Automating email confirmations offers several benefits:

  1. Immediate Acknowledgment: Respondents receive instant confirmation that their submission was successful.
  2. Efficiency: Saves time by eliminating the need to manually send emails.
  3. Professionalism: Provides a consistent and professional response to each submission.

Steps to Automate Email Confirmations

1. Set Up Your Google Form:

  • Ensure your Google Form includes a field for collecting email addresses.
Creating a Google Form

2. Open Google Sheets:

  • Open the Google Sheet linked to your Google Form (Responses are automatically recorded here).
Link to Google Sheet

3. Open Script Editor:

  • In the Google Sheets document, click on Extensions in the menu.
  • Select Apps Script. This will open the Apps Script editor in a new tab.

4. Create a New Project:

  • In the Apps Script editor, delete any existing code in the editor.
  • Copy and paste the following script into the code editor:
Copy Script
Copy Script

5. Replace ‘YOUR_FORM_ID’:

  • Replace ‘YOUR_FORM_ID’ with the actual ID of your Google Form. You can find this ID in the URL of your form.
Find 'YOUR_FORM_ID'

6. Save the Project:

  • Give your project a relevant name, for example, “Email Confirmation Automation”.
  • Click on the floppy disk icon to save the project.

7. Set Up the Trigger:

  • Run the setupTrigger function to set up the trigger that will execute the sendEmailOnFormSubmit function whenever a form is submitted.
  • The first time you run the script, you will be prompted to authorize it to access your Google account.

8. Authorize the Script:

  • An authorization dialog from Google will appear. Click “Continue” and choose your Google account.
  • Click “Allow” to authorize the script to access your Google Forms and send emails on your behalf.

9. Test the Automation:

  • Submit a response to your Google Form.
  • Check the email address you provided to ensure you received the confirmation email.

Handling Errors with Gen AI

If you encounter errors while running the script, you can leverage Gen AI to help troubleshoot and fix the issue, ChatGPT can be particularly helpful in these situations:

  • Describe the Error: Provide a detailed description of the error you encountered.
  • Paste Error Code: Copy and paste the error code or message into your prompt.
  • Request a Fix: Ask the AI to help resolve the error, providing context and any relevant code snippets.

Example Prompt for Troubleshooting:

I encountered the following error while running my Google Apps Script: “TypeError: Cannot read property ‘getValues’ of null”. Here is the relevant part of my code:

Copy Script
Copy Script

Please help me troubleshoot and fix this error.

Conclusion

Automating email confirmations with Google Apps Script transforms Google Forms into powerful communication tools, saving time and ensuring immediate acknowledgment of form submissions.

By following the steps outlined in this article, you can set up your own automated email responses, impressing your respondents with timely and professional confirmations.

Remember, if you encounter any issues, Gen AI tools like ChatGPT are there to help you troubleshoot and refine your scripts. Happy automating!

Copy Script

By Ali Reza Azmi

Founder & Consultant @ Twenty-Four Consulting

By Ali Reza Azmi

Founder & Consultant @ Twenty-Four Consulting

Automation can be Super EASY, and FREE.

With Google Apps Script & Gen AI, you don't need to be a coder to automate anymore!

Watch our demo, download our free cheat sheet, and join the waitlist today.

Google Apps Script Waitlist Image

Related Posts