Saturday, February 23, 2013

Javascript functions in Google Spreadsheets

Hello,

Currently, all of my form submissions from my website are creating a copy of the information submitted and posting in on spreadsheets in Google Docs as well as forwarding the information to my specified email. When I open the form submissions that were received in my email, the from and/or reply to address contains my gmail email. I would prefer that the from and/or reply to address contain the email of the for submitter in order to reply to the appropriate email. The following script is contained in my Google spreadsheets. Your support in resolving this issue is greatly appreciated.

function sendEmail() {
var formSheet = SpreadsheetApp.getActiveSheet();
var firstRow = 2; //Skip a row for column labels
var lastForm = formSheet.getLastRow();
var lastCol = formSheet.getLastColumn();
var flagCol = null;
var subject = formSheet.getName() + " Form";
var mailTo = "";
var collaborators = SpreadsheetApp.getActiveSpreadsheet().getCollaborators();


GmailApp.sendEmail('ryan.potter@promedeq.com', subject + formVals[1], message, {"htmlBody": html});
form.getCell(1, flagCol+1).setValue(true);
SpreadsheetApp.flush(); // Make sure the cell is updated right away in case the script is interrupted
}
}
}