How to Redirect Google Form Data to Your Personal Email

If you want to create highly optimized contact us form then you have to know such advanced script like JavaScript, PHP, HTML5 etc. but a very good news is that Google drive offers creating Google forms (highly optimized for any site or blog) having multiple flexibilities like creating contact form, complex polls thereby Google forms are the excellent tool and best ever to me.
Creating Google forms are much easy but there is still trouble and that is when a user will send you message the junky snippets will go to your drive form that looks very ugly but if you redirect the message into your personal mail then it will a standard one. With Google script it's possible to redirect form messages into our mail and that is within 5 minutes. Let's see how

First Part: Creating Google Form With Google Drive

Redirecting Google Form Data to Your Personal Email

1. Go to Google Drive and create a contact form using existing Drive Theme or choose any custom theme. Once you have created the form now open form with Google form.

Open google form

2. Inside the form editor click on "View responses" to open Google Spreadsheet that collects responses from Google form.
Click view responses

3. While you're inside the spreadsheet, go to Tools -> Script editor, remove any existing code

Choose script editor

4. Now copy paste following snippet.
    /* Send Google Form by Email v2.0 */
    /* For customization, contact the developer at amit@labnol.org */
    /* Tutorial: http://www.labnol.org/?p=20884 */
    function Initialize() {
    var triggers = ScriptApp.getScriptTriggers();
    for(var i in triggers) {
    ScriptApp.deleteTrigger(triggers[i]);
    }
    ScriptApp.newTrigger("SendGoogleForm")
    .forSpreadsheet(SpreadsheetApp.getActiveSpreadsheet())
    .onFormSubmit()
    .create();
    }
    function SendGoogleForm(e)
    {
    try
    {
    // You may replace this with another email address
    var email = Session.getActiveUser().getEmail();
    // Optional but change the following variable
    // to have a custom subject for Google Form email notifications
    var subject = "Google Docs Form Submitted";
    var s = SpreadsheetApp.getActiveSheet();
    var columns = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
    var message = "";
    // Only include form fields that are not blank
    for ( var keys in columns ) {
    var key = columns[keys];
    if ( e.namedValues[key] && (e.namedValues[key] != "") ) {
    message += key + ' :: '+ e.namedValues[key] + "\n\n";
    }
    }
    // This is the MailApp service of Google Apps Script
    // that sends the email. You can also use GmailApp for HTML Mail.
    MailApp.sendEmail(email, subject, message);
    } catch (e) {
    Logger.log(e.toString());
    }
    }
N.B. Script Credit: Amit Agarwal

Replace code

5. Press Ctrl+S (or Cmd+S on Mac) to save the code and give your project any name (say “Send Google Forms by Email”)

6. Navigate to run menu and choose Initialize.

Click initiate

7. The Google script will now require you to authorize the script, just click "Continue"

Continue

8. Finally accept and you're done!

Accept authorization

How to disable notification?

If you need to disable notifications, open the script editor again and choose Resources -> Current Script Triggers and delete the Form trigger associated with the "On Form Submit" action.

Disable notification

Try Out Your Form and Check Email

I have tried out my form and it gave me the information well so i recommend you to try out the form and i'm sure it will work the same as me.

Here is the information Google script sends to me

Email is sent by Google form

Need Help?

I think the tutorial is quite easy to create and manage Google form responses to your personal mail. Google script is the most flexible tool to develop any app so quickly likewise redirecting Google form data to your mail. If you need more help regarding this tutorial don't forget to ask me any kind of query. Your feedback is always appreciated.

0 comments

About

The Wild Blogger is a technology blog which covers all popular and trending news of the web, tech tutorials, blog, blogging tips and tutorials, seo tips, social media marketing, content marketing and tools. Read More...

Browse by Topics

SEO Social Media Make Money

Blogger Tricks Tutorials

Blogging Tips Photoshop