How to Get Form Data from Google Docs in an Email Message

If you have a website or blog site, you may include a “Contact Form” or poll on it to attract more online visitors. For this case, you can seek the ability of Google Docs in accepting such tasks. Actually, most website owners decided to settle with Google Docs in posting contact forms and polls as it helps them to be updated immediately through email if someone has already edited the contact form or poll.

Google Docs

On the provided image, you can see that you can be immediately notified once the contact form has been edited. However, the limitation here is that you will not be able to view the whole details. There’s just a link which will still need you to open a link to redirect you to the Google Docs. This tutorial will help you to access the contact form in one clear email with Gmail. This is a very helpful hack especially if you are always in a hurry tracking down the form’s development.

The Process:

  1. First, you will need to create a new Google Docs form and make sure it is in the “Spreadsheet” view.
  2. Look for the “Tools” button and go to the “Script Editor”. Copy and paste the following ode into that code editor. With the variable “email”, replace it with your actual email address:

    function sendFormByEmail(e)


    // Remember to replace XYZ with your own email address 

    var email = “XYZ”; 

    // Optional but change the following variable

    // to have a custom subject for Google Docs emails 

    var subject = “Google Docs Form Submitted”; 

    // The variable e holds all the form values in an array.

    // Loop through the array and append values to the body. 

    var message = “”;

    for(var field in e.namedValues) {

    message += field + ‘ :: ‘

    + e.namedValues[field].toString() + “nn”;


    // This is the MailApp service of Google Apps Script

    // that sends the email. You can also use GmailApp here. 

    MailApp.sendEmail(email, subject, message); 

    // Watch the following video for details


    // By Sathish V. –


  3. After pasting the code exactly, proceed to “Triggers” then click on “Current Script’s Triggers”. Under the “send Mail” function, choose “On Form Submit”.
  4. Save all the changes, make sure you will allow Google Docs to access your Gmail account whenever you send emails.
(Visited 478 times, 36 visits today)


  1. Keep getting the following message. How do I fix it? TypeError: Cannot read property “namedValues” from undefined. (line 11)

Speak Your Mind