I am trying to have the google forms on our website auto-notify us when a user completes the form and then retu the data that they entered in a concise email. I do not like the way google notifies you it simply links to you the form to view the response. I searched online and found this code:
function sendFormByEmailPrayer(e)
{
// Remember to replace XYZ with your own email address
var email = "admin@communionchapelefca.org";
// Optional but change the following variable
// to have a custom subject for Google Docs emails
var subject = "Prayer Form Form Submitted";
// The variable e holds all the form values in an array.
// Loop through the array and append values to the body.
var s = SpreadsheetApp.getActiveSheet();
var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
var urlToDoc = SpreadsheetApp.getActive().getUrl();
var body = "";
body = body + "Link to Document: " + urlToDoc;
var message = body + "" + "";
// Credit to Henrique Abreu for fixing the sort order
for(var i in headers)
message += headers[i] + ' = '+ e.namedValues[headers[i]].toString() + "";
// 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
// http://youtu.be/z6klwUxRwQI
// By Amit Agarwal - www.labnol.org
}
It works great on my one form, but when I copied and pasted this working code to our other 6 forms, it does not work at all. How do I get this to work across our 7 forms? Thanks in advance.
