NEED HELP WITH GOOGLE SCRIPT EDITOR *prays there is someone who knows this here*

100 views
Created

Hiiiii guys! So... I copied this code from the internet and am struggling hardcore to adapt it to my needs... and I figured WHY NOT ASK THE KIND PEOPLE OF RPR?! I know we have some 'real' coders here, mixed in with the HTML coder - graphic designer wizzes making bootiful layouts galore.

The Code

  /**
 * Sends emails with data from the current spreadsheet.
 */
function sendEmails() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var startRow = 2; // First row of data to process
  var numRows = 2; // Number of rows to process
  // Fetch the range of cells A2:B3
  var dataRange = sheet.getRange(startRow, 1, numRows, 2);
  // Fetch values for each row in the Range.
  var data = dataRange.getValues();
  for (var i in data) {
    var row = data[i];
    var emailAddress = row[0]; // First column
    var message = row[1]; // Second column
    var subject = 'enter subject here'
    MailApp.sendEmail(emailAddress, subject, message);
  }
}

 

What I don't get

1. I think I understand how to select the numbers of rows data should be taken from, but how do I set the number of columns? Like, why is this code for A2:B3?? How would I stretch this to e.g. A2:C3?

2. For the subject line, can I make it part code and part text? i.e. ' [data in some cell]/abc Subject Line blahblah'

3. Can I make the email text part code and part text as well? Like above? How?

4. That's all my questions for now... just one more: How did you learn this stuff? OTL

Comments

You must be logged in to comment.

There are no comments yet
Log in to view all comments and replies