My code sends email notifications every time a Google Form is submitted. It works, but I want the collected form data as bold in the email.
for(var i in headers)
message += headers[i] + ': '+ e.namedValues[headers[i]].toString() + "\n\n";
function sendFormByEmail(e)
{
var s = SpreadsheetApp.getActiveSheet();
var headers = s.getRange(1, 1, 1, s.getLastColumn()).getValues()[0];
var message = "";
var data = s.getRange(1, 1, 1, s.getLastColumn()).getValues()[0];
var subject = "";
//Get active Spreadsheet
var ss = SpreadsheetApp.getActiveSpreadsheet();
//Get Sheet called 'Form responses 1'
var fr1 = ss.getSheetByName("Form responses 1");
//Get all emails from 'Emails' tab
var emails = ss.getSheetByName("Emails");
var numRows = emails.getLastRow();
var emailTo = emails.getRange(2, 2, numRows, 1).getValues();
// The variable e holds all the form values in an array.
// Loop through the array and append values to the body.
for(var i in headers)
message += headers[i] + ': '+ e.namedValues[headers[i]].toString() + "\n\n";
// Insert variables from the spreadsheet into the subject.
// In this case, I wanted the part number as part of the
// email subject. These are the 3rd and 16th columns in my form.
// This creates an email subject like "Parts Inquiry Submission: 729302"
subject += e.namedValues[headers[1]].toString();
// Send the email
MailApp.sendEmail(emailTo, subject, message);
// Based off of a script originally posted by Amit Agarwal - www.labnol.org
// Credit to Henrique Abreu for fixing the sort order
}