Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
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 answers
Answer question

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 Report

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!