I am new to codes. I created this code to send an email with attachments but it’s not working.
We get the URL through “var ppt” that is from a google sheets cell and I tried to transform in a URL inside javascript in the “var file” and send via “attachments: [file]” in the “MailApp.sendEmail”.
Thanksss.
function kickoff1() {
//Declarando as variáveis
var planilha = SpreadsheetApp.getActiveSpreadsheet();
var aba_sanidade = planilha.getSheetByName("Envios");
var ppt = aba_sanidade.getRange("F4").getValues();
var file = DriveApp.getFilesByType(ppt);
//Iniciando e-mail
var assunto = 'Kickoff - Parte 1'
var corpo = "Oi, pessoal! :)"
var emails = "email"
MailApp.sendEmail({
to: emails,
subject: assunto,
htmlBody: corpo,
attachments: [file]});