Zev Burton
Zev Burton

Reputation: 1

How to get a range of text to appear as opposed to the word "Range"

I am trying to get certain company names to send to my email every day. I have set up the trigger and whatnot, but when I run the code, since I am trying to use a range of data, the email just says "Range," as opposed to the company names themselves.

I have tried various formatting, such as only saying A3:A9 as opposed to "A3:A9".

function EmailCheck() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var range = sheet.getRange("A3:A9")

MailApp.sendEmail("[email protected]", "Emails for Today!", range)
}   

I would like the email to say the words in range A3:A9, but right now it just says A3:A9

Upvotes: 0

Views: 41

Answers (1)

ross
ross

Reputation: 2774

Problem:

At the moment you're only getting a range object, not the values inside the range object.


Solution:

You need to pass your range to .getValues() to achieve your goal.

var range = sheet.getRange("A3:A9");
var values = range.getValues();

MailApp.sendEmail("[email protected]", "Emails for Today!", values);

References:

Upvotes: 2

Related Questions