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

246
Vistas
Sytax error: Missing ), but I don't see it. My quotation marks don't seem to be the problem either

I've been working on this app script trying to automate data from a Google sheet to create events on Google Calendar. I've tried changing the Quotation marks from single to double and back. I've checked my () over and over. I cannot see what I've done that gives me the syntax error. If you can see it, please tell me. This is making me nuts.

function AutomateCalendarEvent() {
  let sheet = SpreadsheetApp.getActiveSheet();
  let pqCalendar = CalendarApp.getCalendarById("zyxwvutsrqp");  
  let reservation = sheet.getRange("C2:E1105").getValues();
  reservation.splice(0, 1);
  let rows = sheet.getDataRange().getValues();
  rows.forEach(function (row, index)  {
    if (index === 0) return;
    if (row[C3]) return;
    
  pqCalendar.createAllDayEvent("Last Name"C2:C, "Arrival Date"D2:D, "Departure Date"E2:E);
    
   })
}
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Take a look at my comments

function AutomateCalendarEvent() {
  let sheet = SpreadsheetApp.getActiveSheet();
  let pqCalendar = CalendarApp.getCalendarById("zyxwvutsrqp");  
  let reservation = sheet.getRange("C2:E1105").getValues();
  reservation.splice(0, 1);
  let rows = sheet.getDataRange().getValues();
  rows.forEach(function (row, index)  {
    if (index === 0) return;
    if (row[C3]) return;//C3 should be an index between 0 and 2
    
  pqCalendar.createAllDayEvent("Last Name"C2:C, "Arrival Date"D2:D, "Departure Date"E2:E);//parameters should be a string followed by two dates
    //this is not the way insert parameters into above command.  Ranges do not return values
   })
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

Assuming your data are as follows

enter image description here

Try (to prevent duplicates, the event ID is here stored in column AI fr instance)

function AutomateCalendarEvent() {
  let sheet = SpreadsheetApp.getActiveSheet();
  let swCalendar = CalendarApp.getCalendarById("***********@gmail.com");
  let rows = sheet.getRange(1, 1, sheet.getLastRow(), sheet.getLastColumn()).getValues();
  rows.filter(row => row[2] != '').forEach(function (row, index) {
    if (index === 0) return;
    if (row[34] == '') { // AI
      try {
        sheet.getRange('AI' + (+index + 1)).setValue(swCalendar.createAllDayEvent(row[2], row[3], row[4]).getId())
      } catch (e) { console.log(e) }
    }
  })
}

reference

createAllDayEvent(title, startDate, endDate, {options})

enter image description here

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