Automatically Email Google Form Submissions (Including File Uploads) 📨
July 11, 2025
Ever wished you could get an instant email when someone submits your Google Form complete with their answers and any files they uploaded? With a few lines of Apps Script, you can!
Let’s break it down 🕵️
🧩 Why Use This Script?
This solution answers a common need: getting notified via email when someone submits a form response. Especially useful when:
You’re collecting job applications or portfolios.
You want to automate intake notifications.
Your form includes file uploads, and you want the file attached in the email.
Let’s break it down 🕵️
- 1. Access Apps Script from your Google Forms
- 2. Insert the snippet
- 3. OnFormSubmit(e) trigger
- 1. Access Apps Script from your Google Forms
In my experience, many people aren’t aware that you can actually embed an Apps Script project directly into a Google Forms.
Just like with Google Sheets, you can add custom menus, user interfaces, and powerful automations. Plus, Forms come with their own set of unique triggers you can take advantage of!
- 2. Insert the snippet
This function automatically sends an email to a specified recipient when a form is submitted.
It collects the user’s responses and loops through them to build the HTML body of the email.
If a response is of the FILE_UPLOAD type, the script retrieves the uploaded file and includes it as an attachment in the email.
You can check the full list of item types here, and handle each response accordingly!
/**
* Function triggered upon form submission to send email with form responses.
* @param {Object} e - The event object that contains the form response.
*/
function onFormSubmit(e) {
// Recipient email
const recipient = "lidia@gmail.com";
// Extract the form responses
const responses = e.response.getItemResponses();
const submitter = e.response.getRespondentEmail();
console.log(responses)
// Create the email subject and body
let subject = `New application received`;
let htmlBody = `Application submitted by ${submitter}:`;
let img;
// Loop through the responses and create bullet points
for (let i = 0; i < responses.length; i++) {
let itemResponse = responses[i];
if (itemResponse.getItem().getType() == "FILE_UPLOAD") {
const answer = itemResponse.getResponse();
img = DriveApp.getFileById(answer);
} else {
const question = itemResponse.getItem().getTitle();
const answer = itemResponse.getResponse();
htmlBody += `${question}: ${answer}`;
}
}
htmlBody += ``;
// Send the email
GmailApp.sendEmail(recipient, subject, "", {
htmlBody: htmlBody,
attachments: img
});
}
- 3. OnFormSubmit(e) trigger
On your right panel, access the trigger section and click “Add a trigger”
Select the function to launch, here onFormSubmit, and chose the
event type “When submitting the form”, then save.
Heads up! ⚠️
Before your function can run properly on form submission, you need to authorize the necessary scopes your script uses. To do this, just run any function manually from the script editor, this will trigger the authorization prompt. Approve it, and you’re good to go!
You’re all set! Want to take it a step further? You could:
Send the email to multiple recipients
Save submissions to a Google Sheet
Enhance the HTML formatting for a more polished look
Plenty of ways to level up from here!