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

404
Vistas
how to automatically add a schedule from Google Sheets into Calendar?

I have tried to implement this code to integrate google calendar with my spreadsheet, but i am fail until now. Follow the code...

function scheduleShifts() {
var spreadsheet = SpreadsheetApp.getActiveSheet();
    var calendarId = spreadsheet.getRange("Dados!CJ3").getValue();
    var eventCal = CalendarApp.getCalendarById(calendarId);
var signups = spreadsheet.getRange("Dados!CI5:CK3500").getValues();
for (x=0; x<signups.length;x++)
{
    var shift = signups[x];
    var startTime = shift[0];
    var endTime = shift[1];
    var volunteer= shift[2];
    eventCal.createEvent(volunteer,startTime,endTime);
}
}

Error message:

21:19:29 Erro Exception: The parameters (String,String,String) don't match the method signature for CalendarApp.Calendar.createEvent. scheduleShifts @ Agenda.gs:12

Based article:

https://cloud.google.com/blog/products/g-suite/g-suite-pro-tip-how-to-automatically-add-a-schedule-from-google-sheets-into-calendar

Can you help me?

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

0

Try this:

function scheduleShifts() {
  var spreadsheet = SpreadsheetApp.getActiveSheet();
  var calendarId = spreadsheet.getRange("Dados!CJ3").getValue();
  var eventCal = CalendarApp.getCalendarById(calendarId);
  var signups = spreadsheet.getRange("Dados!CI5:CK3500").getValues();
  for (x=0; x<signups.length;x++) {
    var shift = signups[x];
    var startTime = new Date(shift[0]);
    var endTime = new Date(shift[1]);
    var volunteer= shift[2];
    eventCal.createEvent(volunteer,startTime,endTime);
  }
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

The method signature for calendar#createEvent is

enter image description here

You are currently sending string parms (String,String,String). As shown in the error message

Exception: The parameters (String,String,String) don't match the method signature for CalendarApp.Calendar.createEvent. scheduleShifts

While the method requires that both the start date and end date are actually dates not strings.

var event = CalendarApp.getDefaultCalendar().createEvent('Apollo 11 Landing',
    new Date('July 20, 1969 20:00:00 UTC'),
    new Date('July 21, 1969 21:00:00 UTC'));
Logger.log('Event ID: ' + event.getId());
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