What You'll Build
In this tutorial, you'll create an automatic email responder that fires every time someone submits a Google Form. The email will be personalized using the submitter's own responses — their name, chosen options, and any other fields. This is a genuinely useful automation for event registrations, contact forms, support requests, and more.
What you need:
- A Google Form (any form with at least a name and email field)
- The linked Google Sheet (Forms automatically create one)
- Access to Apps Script (via the Sheet: Extensions → Apps Script)
Step 1: Set Up Your Google Form
Create a form with the following fields (or adapt to your own):
- Full Name (Short answer)
- Email Address (Short answer)
- What can we help you with? (Paragraph or Multiple choice)
Connect the form to a spreadsheet by clicking the Responses tab → Link to Sheets. Google will create a sheet where each submission becomes a new row.
Step 2: Examine the Spreadsheet Structure
Open the linked spreadsheet. You'll see columns like:
| Column A | Column B | Column C | Column D |
|---|---|---|---|
| Timestamp | Full Name | Email Address | What can we help you with? |
Note the column order — your script will reference columns by index (0-based in JavaScript arrays, but keep in mind getValues() returns a 2D array).
Step 3: Write the Auto-Responder Script
In the linked sheet, go to Extensions → Apps Script and replace the default code with:
function sendAutoResponse(e) {
// e.values is an array of form submission values
// Order matches the column order in your sheet
const timestamp = e.values[0];
const fullName = e.values[1];
const emailAddr = e.values[2];
const helpRequest = e.values[3];
const subject = `We received your message, ${fullName}!`;
const htmlBody = `
<div style="font-family: Arial, sans-serif; max-width: 600px;">
<h2 style="color: #1a73e8;">Thanks for reaching out, ${fullName}!</h2>
<p>We've received your submission and will be in touch shortly.</p>
<h3>Here's what you submitted:</h3>
<table style="border-collapse: collapse; width: 100%;">
<tr>
<td style="padding: 8px; border: 1px solid #ddd; font-weight: bold;">Submitted At</td>
<td style="padding: 8px; border: 1px solid #ddd;">${timestamp}</td>
</tr>
<tr>
<td style="padding: 8px; border: 1px solid #ddd; font-weight: bold;">Your Request</td>
<td style="padding: 8px; border: 1px solid #ddd;">${helpRequest}</td>
</tr>
</table>
<p style="color: #666; margin-top: 24px; font-size: 12px;">
This is an automated confirmation. Please do not reply to this email.
</p>
</div>
`;
GmailApp.sendEmail(emailAddr, subject, "", { htmlBody: htmlBody });
Logger.log(`Auto-response sent to ${emailAddr} at ${new Date()}`);
}
Step 4: Create the Form Submit Trigger
The function won't run automatically yet — you need to bind it to the form's submit event:
- In the Apps Script editor, click the clock icon (Triggers) in the left sidebar.
- Click + Add Trigger (bottom right).
- Set Choose which function to run →
sendAutoResponse. - Set Select event source → From spreadsheet.
- Set Select event type → On form submit.
- Click Save and authorize the script when prompted.
Step 5: Test It
Submit your Google Form with a real email address. Within a few seconds, the auto-response should arrive in the inbox. Check the Executions log in Apps Script if anything goes wrong — it will show you the exact error and line number.
Extending This Further
Once the basic auto-responder is working, consider these enhancements:
- Notify your team too: Add a second
GmailApp.sendEmail()call to send an internal notification to your team's inbox. - Log to a separate sheet: Record every auto-response sent in a "Log" sheet for auditing.
- Conditional responses: Use
ifstatements to send different email templates based on which option the user selected. - Add a calendar invite: If the form is for a meeting or appointment, automatically create a calendar event and invite the submitter.
This tutorial demonstrates the core pattern behind dozens of powerful automations: trigger → read data → take action. Once you internalize this loop, the possibilities with Apps Script are nearly unlimited.