Last active
May 9, 2017 16:20
-
-
Save matticusfinch/1459cbd8bf0aa053c1ff0c4fc6f73ecc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendFormByEmail(e) | |
{ | |
var email = "[email protected]"; | |
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