Skip to content

Instantly share code, notes, and snippets.

@sauntimo
Created November 9, 2012 19:51
Show Gist options
  • Save sauntimo/4047814 to your computer and use it in GitHub Desktop.
Save sauntimo/4047814 to your computer and use it in GitHub Desktop.
Looping through Object Properties
function OnSubmit(e){
var NewSubmission = {};
var Properties = ["Timestamp","Favourite Colour","Explanation"];
var i = 0;
for(i = 0; i < Properties.length; i++){
NewSubmission[Properties[i]] = e.values[i];
}
MailApp.sendEmail("gassnippets@gmail.com", "Your form was submitted!",
"Hey you!" +
"\n\n Someone submitted your form. Here's what they had to say:" +
"\n\n Favourite Colour: " + NewSubmission["Favourite Colour"] +
"\n Explanation: " + NewSubmission["Explanation"])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment