Google Forms – How to Send Form Results to an Email

google-apps-scriptgoogle-forms

I need help with the google form.
The problem is this: I want to receive an email with its results for every user who completes the form.
For example, if you had a form that required email, name and surname. I would like to receive an email like this:
"
New registered user
mail: newuser@user.com
name: jon
surname: kess
"

I tried addons, but they either didn't work or were limited to a few emails.
Thank you all

Best Answer

You can do that with a simple script.

To write the script you should use the Script Editor on the answers spreadsheet linked to the form (not the script editor in the form).

  • Go to Tools -> Script editor...
  • When in the script editor, erase all the presented code and replace it with the following:

The code:

// Auto-Confirmation Email to "myemail@xyz.com"

   function AutoConfirmation(e){
      var theirFirst = e.values[2];
      var theirLast = e.values[3];
      var theirEmail = e.values[4];
      var myEmail = "myemail@xyz.com";
      var theWhat = e.values[1];
      var subject = "New Form Submitted";
      var message = "New registered user mail: " + theirEmail + " name: " + theirFirst + " surname: " + theirLast + " has filled the form: " + theWhat; 

   MailApp.sendEmail (myEmail, subject, message);
   }
  • Save
  • Authorize
  • Now click on the clock icon on the toolbar and on the new page, set up a trigger for On form submit and save the trigger.

trigger

  • Test and Enjoy!

Notes

The e.values 1, 2, and so on, correspond to the columns on the spreadsheet where the answers are submitted. Keep in mind that the numbering for the columns start with 0. (Zero being the column reserved for the timestamp.)

*You can read all about limitations on Google accounts and triggers at: Quotas for Google Services and Simple Triggers

EDIT (following OP request)

How I can do bold in the var message?

I am afraid you will complicate things. I would stick to just changing lines using the accepted \n. Please have a look at the updated code:

function AutoConfirmation(e){
   var theirFirst = e.values[2];
   var theirLast = e.values[3];
   var theirEmail = e.values[4];
   var myEmail = "myemail@xyz.com";
   var theWhat = e.values[1];
   var subject = "New Form Submitted";
   var message = "New registered user: \n\n EMAIL: " + theirEmail + " \n FIRST name: " + theirFirst + " \n LAST name: " + theirLast + " \n\n Filled form: " + theWhat; 

MailApp.sendEmail (myEmail, subject, message);
}

PS: Please try following the site rules as explained here and when in need of clarifications just add a comment, not an answer (as you just did).