Google Forms Email Script

Page 1

Creating a Form Open up Google Docs and Select “Create New

Form” .

Create your form with your questions. You can use any type of question in your form and the results will be emailed to the email address input by whoever fills out the form. An example form for this process is available at http://goo.go/DOzW8. Please do not alter this spreadsheet but make your own copy. Tip: Forms and spreadsheet icons are different. Forms Spreadsheets

Once you’ve created your questions, go back to your Google Docs list, find the form you just made and open the spreadsheet. You will see that your questions are already filled out in row 1.

Creating the Script Click on the “Tools” dropdown menu and select “Script Editor”. This will open up the “Google Apps Script” window. Leave this page open and go to http://goo.gl/qihBj. This is the script that you need. Copy the entire page and go back to the “Google Apps Script” window. Delete all contents in this window and paste the script you just copied into the “Code” area. Click on the field at the top where you see the words “Untitled project” and give the project a name (ex. Mail script). Click the disc to save.

www.mrbassonline.com

2011 - Bill Bass


Email Script for Google Form

There are two lines of this script that should be altered based on your needs. In line 4, the last number must be equal to the number of columns in your spreadsheet (including the “Timestamp”). In this case, the number “8” signifies the number of total columns.

8 columns in spreadsheet =

In line 22, change the text in quotation marks (ex. “Answers to mail merge form”) to whatever text is desired for the subject of the email to be sent. Quotation marks are essential to the the script.

Save script again and close the Google apps script window. The script must be saved for it to work.

Compose the email Open back up the spreadsheet that is associated with the desired form and create a new sheet by clicking the symbol. Rename this sheet, “Email template”, by clicking on the small arrow on the right side of tab. Rename

Add sheet

Open a new browser tab and go to http://goo.gl/la2Px. Copy all of the text below the horizontal line. This is the email that will be sent to the email address entered into the form. Double click on cell A1 in the “Email Template” sheet on the spreadsheetand paste this text. All text found outside the brackets and quotation marks is completely customizable by you. The text inside the quotation marks must be identical to the first row of the spreadsheet for the script to pull the correct information. Add lines as needed based on the information to be emailed.

www.mrbassonline.com

2011 - Bill Bass


Email Script for Google Form

Running the Script The form is now ready to accept submissions. As the form is filled out, each line of the resulting spreasheet will fill in based on the information. Once all data is in the spreadsheet and you are ready to send information via email, it’s time to run the script.

In the spreadsheet, select “Tools” then “Script manager” from the dropdown. This will open up a new window with all the scripts available in this spreadsheet.

Note: Any time this script is run, an email will be sent to all emails on the list unless those rows are deleted or cleared. It’s not possible to only send specific rows With this script (to the best of my knowledge).

Select the “sendEmails” script from the “Script Manager” list and click on “Run” at the bottom of the window. The first time you run this script you will have to authorize it to run. Click “Authorize” and then click “Run” again from the “Script Manager”. While it may not seem like anything has happened, emails will be sent to each email in its own row on your spreadsheet. Note: The script can also be run by going to the “Script editor”, select “Run” and select “sendEmails”. A message will display at the top of the window verifying that the script is running. For an example, go to http://goo.gl/DOzW8 and make a copy of this spreadsheet to work with. Please do not alter the existing form or spreadsheet. www.mrbassonline.com

2011 - Bill Bass


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.