Soy nuevo en la codificación y tengo problemas con un código en el que sigo recibiendo "Error Syntaxis: Missing) después del argumento
Este es mi código actual:
function myFunction(){ const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet('Form Responses 1'); const url = sheet.getRange().getValues(); url.forEach(function(row,index){ if (index === 0) return; if (row[19]) return; const idFile = url.match(/[-w]{25,}/); const file = DriveApp.getFileById(idFile) const blob = file.getAs(MimeType.PDF) var message = 'Thanks for your interest this will be the first step' var mail = row[2] var team = row[8] GmailApp.sendEmail(mail,team,"Subject",message,{attachments: [blob]})Este es mi segundo script, el primero que construí para crear PDF para cada nueva entrada de formulario de Google y en la columna 19 está escrito el enlace PDF. La idea es que después de que se crea el enlace PDF, toma la identificación del archivo y luego lo envía automáticamente a la persona que llenó el formulario con CC a mi equipo si no se crea un enlace, entonces no debería enviarlo.
Pero he investigado y sinceramente no se mucho para identificar mi error, espero que alguien me pueda ayudar se lo agradecería. ¡O no dando la respuesta, pero se agradecería ayuda en cualquier forma!
function myFunction() { const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet('Form Responses 1'); const url = sheet.getRange().getValues(); url.forEach(function (row, index) { if (index === 0) return; if (row[19]) return; const idFile = url.match(/[-w]{25,}/); const file = DriveApp.getFileById(idFile) const blob = file.getAs(MimeType.PDF) var message = 'Thanks for your interest this will be the first step' var mail = row[2] var team = row[8] GmailApp.sendEmail(mail, team, "Subject", message, { attachments: [blob] }) });//your missing the parenthesis here after the arrow function }Te faltan varios corchetes de cierre y paréntesis.
function myFunction(){ const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet('Form Responses 1'); const url = sheet.getRange().getValues(); url.forEach(function(row,index){ if (index === 0) return; if (row[19]) return; const idFile = url.match(/[-w]{25,}/); const file = DriveApp.getFileById(idFile); const blob = file.getAs(MimeType.PDF); var message = 'Thanks for your interest this will be the first step'; var mail = row[2]; var team = row[8]; GmailApp.sendEmail(mail,team,"Subject",message,{attachments: [blob]}); }); }