0

Instead of assigning one static email to the "var email" below (or for that matter multiple emails separated by commas), my question is how do I enter the column E value from the Google Sheet this script is pulling from? Column E contains an email value that varies depending on who is using the form, and we need the script to send to that address specifically each time it is filled out.

Any suggestions would be very helpful. I found similar and related posts, but nothing exactly like this. I also posted in Stack Overflow as I was unsure where this should be housed.

function sendFormByEmail(e) 
{    
  // Enter email address for form respondent below.
  var email = “example@quest.com"; 

  var s = SpreadsheetApp.getActiveSheet();
  var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];    
  var message = "";
  var subject = "Instructional Rounds: ";

migrated from superuser.com Oct 31 '15 at 6:42

This question came from our site for computer enthusiasts and power users.

2

You could use a for loop and iterate down Column E, which is column 5. Then insert the cell values into an array.

var data = s.getDataRange().getValues();
//var data = s.getRange(1,5,s.getLastRow(),1).getValues();
var emails = [];

for (var row in data) {
    var cell_value = data[row][5];
    emails.push(cell_value);
}

for (var e in emails) {
    // TODO: Perform operations on emails[]
}
  • Trying this now ... thanks. – oemb1905 Oct 30 '15 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.