Dear ones, I need your help.
I have this code that sends an email with an attached file. This file must be in the same drive as the script.
function sendEmails () {
var FileToSend = "MyFile.xls";
var Message = "Hello";
var Subject = "SUBJECT"
var file = DriveApp.getFilesByName (FileToSend)
if (file.hasNext ()) {
var file = file.next ();
}
GmailApp.sendEmail (recipient, subject, message, {attachments: file});
}
};
I would like the script to take a file from TeamDrive "XXX". It's possible to do it?
I thank you for your precious help.