Email PDF Help

Skip to first unread message

Jeff W

Jan 25, 2023, 5:39:19 PMJan 25
to Google Apps Script Community
I'm trying to make the script pull an email address from the "Invoices" sheet at A1. What am I doing wrong here?

function sendReport() {
  var message = {
    to: SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Invoice').getRange(1,1),
    subject: "Chroma Invoice",
    body: "Please see your attached invoice!",
    name: "Bob",
    attachments: [SpreadsheetApp.getActiveSpreadsheet().getAs(MimeType.PDF).setName("Chroma Invoice")]

Bradley Jordan

Jan 30, 2023, 6:52:47 AMJan 30
to Google Apps Script Community
Hi Jeff,

Apologies if you already fixed this, but it looks like in your message, the to: field is just getting a range rather than the value in that range, so you need to put:
 to: SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Invoice').getRange(1,1).getValue(),

(I think!)
Reply all
Reply to author
0 new messages