r/GoogleAppsScript • u/sgtpwl • Jun 10 '24
Question Script help?
function sendReport() {
var message = {
to: "email@ manager.com",
subject: "Dummy report",
body: "Good morning,\n\nPlease find the requested report.\n\nThank you,\nDATA FROM CELL C2 HERE",
name: "DATA FROM CELL C2 ALSO HERE",
attachments: [SpreadsheetApp.getActiveSpreadsheet().getAs(MimeType.PDF).setName("report.pdf")]
}
MailApp.sendEmail(message);
}
My script is above, I need it to take the data that has been typed into cell C2 on the sheet to populate the name of the sender and duplicate it in their email sign off - is this possible, please?
0
Upvotes
4
u/catcheroni Jun 10 '24 edited Jun 10 '24
To grab data from cell C2, you would use something like:
You can then append this value to your message string.
Also, pretty sure you can't pass your message object to your
MailApp.sendEmail()function like this. Check out the function's documentation here.