Skip to content

Instantly share code, notes, and snippets.

@hoosteeno
Created August 21, 2019 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoosteeno/bafe1146acb436f7695118f02f03ca30 to your computer and use it in GitHub Desktop.
Save hoosteeno/bafe1146acb436f7695118f02f03ca30 to your computer and use it in GitHub Desktop.
// https://gist.github.com/hoosteeno/aeabac67db5a57817c4070df8f8f7a80
function onFormSubmit(e) {
var dest = 'anemail@example.com';
var values = e.values;
var s = SpreadsheetApp.getActiveSheet();
var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
var subject = "#Incoming " + values[2].substring(0,68); // max subject length 78 chars
var message = "";
for (var i = 0; i<values.length; i++) {
var question = headers[i];
var response = values[i];
message = message + '**' + question + ':** ' + response + '\n\n';
}
GmailApp.sendEmail(dest, subject, message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment