Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

108
Vistas
How to get file ID to send mails from GoogleSheets/Script

I'm new to coding and i'm having issues with a code where i keep getting "Error Syntaxis: Missing ) after argument

This is my current code:

    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]})

This is my second script, the first one i built it to create PDF for each new google form entry and in column 19 the PDF link is written. The idea is that after that PDF linked is created it takes the file ID and then sends it automatically to the person that filled the form with CC to my team if there is no link created then it should not send it.

But i have researched and i honestly don't know much to identify my error, i hope anyone can help me i would appreciate it. Either not by giving the answer but help in any form would be appreciated!

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Missing parenthesis after the arrow function see comment below

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
 }
about 4 years ago · Juan Pablo Isaza Denunciar

0

You're missing several closing brackets and parenthesis.

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]});
    });
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda