Task guide
Respond to a Google Form submission
Add a small response function, then install a form-submit trigger so each new answer produces a private email summary.
1 · Prepare
Put these pieces in place
- Open the Apps Script project attached to the Google Form.
- Use a form with at least one question so each response has something to summarize.
- Choose an owner account that can receive the notification email.
Change these values
- Email subject
New form responseThis is the subject in the notification email.
2 · Review before running
What the script can access and change
Permissions you approve
- Read submitted responses from the attached Google Form.
- Send a notification email from the script owner account.
Effects of one run
- Sends one private summary email after each new Form submission.
- Does not change or remove Form responses.
3 · Copy
Paste this into the Apps Script editor
Create or open a script file, replace the example values marked above, then save the project.
const EMAIL_SUBJECT = 'New form response'; // This is the subject in the notification email.
/** @param {Events.FormsOnFormSubmit} event */
function emailFormSummary(event) {
const response = event.response;
const answers = response.getItemResponses().map((itemResponse) => {
return itemResponse.getItem().getTitle() + ': ' + itemResponse.getResponse();
});
const message = answers.length ? answers.join('\n') : 'A form response was received with no answers.';
const recipient = Session.getEffectiveUser().getEmail();
GmailApp.sendEmail(recipient, EMAIL_SUBJECT, message);
} 4 · Run safely
Follow these steps in order
Add the response function
In the Form’s Apps Script project, paste the function and save it. Do not run it from the editor because it needs a real submission.
Install the trigger
Open Triggers, choose Add Trigger, select emailFormSummary, then choose From form and On form submit.
Send a practice response
Submit the Form once yourself and check the script owner’s inbox for the summary.
5 · Confirm
How to tell it worked
A newly submitted response produces an email showing each question and its submitted answer.
If the result is different
Troubleshooting
- Running the function from the editor fails.
- That is expected because no form response event is present there. Test it by submitting the Form after installing the trigger.
- No email arrives after a test submission.
- Check that the trigger is From form and On form submit, and confirm the script owner has approved the requested permissions.
Technical details
Names used in this script
Open these details when you want to adapt the example or look up an exact service or method name.
Show Apps Script symbols and service pages
Apps Script symbols
Service pages
Keep going
Related tasks, basics, and apps
- Task guide Run an Apps Script function every day
Run the setup function once, then Apps Script calls the reminder function each day around your chosen hour.
- Task guide Create a Google Doc from each Sheet row
Keep a person and a project note in a Sheet, then create one short Doc per unfinished row.
- Object reference Form
A FormApp.Form is the Google Form itself. Reach it with FormApp.getActiveForm() or openById(id) to read its questions with getItems() or count submissions with getResponses().
- Object reference Form response
A FormResponse contains the answers sent in one Google Form submission. A form-bound submit trigger passes it to your function as event.response, where getItemResponses() returns the submitted item responses.
- Object reference Trigger builder
ScriptApp.newTrigger(functionName) returns a TriggerBuilder that configures a timeBased(), forSpreadsheet(), or forForm() trigger before create() saves it.
- Basics Google Apps Script triggers explained
A Google Apps Script trigger runs a function when an event happens, without pressing Run. Simple triggers like onEdit and onOpen need no setup, while installable triggers run on a schedule or form submit using the OAuth scopes approved by their owner.
- Google app Google Forms
FormApp scripts and form-bound submit triggers run when someone submits a Google Form, passing event.response to your function.
- Google app Triggers
A trigger is a saved schedule or event rule in ScriptApp that runs your function on time, on edit, or on form submit.
- Google app Gmail
GmailApp scripts can send messages, search threads, apply labels, and read attachments after you approve Gmail access for the project.