Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

125
Visualizações
Apps Script Google Calendar API Integration String Class Error

I'm super new to JavaScript, am a marketing executive by trade, but need to create a Google Calendar view from a Google Sheet for our content calendar for myself. After following some YT tutorials and finally running the code itself, I received the following error message:

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

The following is my code:

function addEvents(){
  var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var lr = ss.getLastRow();
  var cal = CalendarApp.getCalendarById("CalendarID");

  var data = ss.getRange("A3:C" + lr).getValues();

  for(var i = 0; i<data.length; i++){
    cal.createAllDayEvent(data[i][1], data[i][0], {description: data[i][2]});

  }

}

In my Google Spreadsheet, the order of the data is as follows (data only appears in A3:C3 and downwards to the bottom rows): column A: Date, B: Event Title, C: Description

Hope to get some help, would appreciate it :'D

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

I just tested your script and I noticed that after changing the date column information to String format it returned the specified error. I changed it back to Date format in the Sheet and it created the events as expected.

Make sure your dates are in the proper format in your Sheet and then try again. After that it should run just fine.

For reference the expected parameters type are specified here

about 4 years ago · Juan Pablo Isaza Relatório

0

You could also try:

cal.createAllDayEvent(new Date(data[i][1]), new Date(data[i][0]), {description: data[i][2]});

about 4 years ago · Juan Pablo Isaza Relatório

0

was able to solve the problem, turns out it was just linked to the wrong spreadsheet hence the issue! The code itself was working already. Appreciate the help!

However, there is something else I just noticed I may need some help with. I would also like for it to be able to update any edits I made to the spreadsheet but also not duplicate the events that were already made from the first run. I know it's got something to do with the GetID string but I'm not too sure how to go about it since this is my first time coding, would really appreciate it anyone can aid with that too? :'D

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda