Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function sendFormByEmail(e)
{
var email = "webforms@safetysync.com";
var subject = 0;
var doc = SpreadsheetApp.getActiveSpreadsheet();
subject = doc.getName();
var message = "*contents*<p><b><u>" + subject + "</u></b></p><br>";
var s = SpreadsheetApp.getActive().getSheetByName("Form responses 1");
var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
for(var i in headers) {
if(headers[i]!=null && e!=null)
message += "<p><b>" + headers[i].toString() + "</b><br>"
+ e.namedValues[headers[i]].toString() + "</p>";
}
MailApp.sendEmail(email, subject, "", {htmlBody: message});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.