Re: Function completes the task, but throws an exception "The parameters (String,String) don't match the method signature for..."

272 views
Skip to first unread message
Message has been deleted

Remco Edelenbos

unread,
Aug 21, 2022, 7:09:31 AM8/21/22
to Google Apps Script Community
Maybe there are some blank rows in the data. Check with an if statement if entry[0] is not blank.

On Friday, 19 August 2022 at 17:17:12 UTC+2 Lars Vilhelmsen wrote:
I'm getting this error, even though the function completes the task:

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

I have written a script to automatically generate calendar entries from data in a spreadsheet. There are two identical functions in the full script, but for some reason the last function posts this error.

function releaseCalendarAutomation(){
  createCalendarEventsTypeA();
  Utilities.sleep(20000);
  createCalendarTypeB();
  }
}
function createCalendarEventsTypeA(){

  let contentReleaseCalendar =  CalendarApp.getCalendarById("[calendarID]@group.calendar.google.com");
  let sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('CalendarAutomationTypeA');
    
   let releases = sheet.getDataRange().getValues();
  releases.splice(0,3);

  releases.forEach(function(entry) {
    contentReleaseCalendar.createAllDayEvent(entry[3]+entry[1], entry[0]);
  Utilities.sleep(250);
});
}
function createCalendarEventsTypeB(){

  let contentReleaseCalendar =  CalendarApp.getCalendarById("[calendarID]@group.calendar.google.com");
  let sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('CalendarAutomationTypeB');
    
   let releases = sheet.getDataRange().getValues();
  releases.splice(0,3); 

  releases.forEach(function(entry) {
    contentReleaseCalendar.createAllDayEvent(entry[3]+entry[1], entry[0]);
  Utilities.sleep(250);
});
}

Sheet with data for TypeA events:
Screenshot 2022-08-19 171258.jpg

Sheet with data for TypeB events:
Screenshot 2022-08-19 170820.jpg

Any ideas as to why, with so similar data sheets and identical functions, the last function throws errors?


Message has been deleted

Jonathan Butler

unread,
Aug 30, 2022, 1:06:40 PM8/30/22
to google-apps-sc...@googlegroups.com
Your [0] argument is a string when it should be a date.  Try 
 var entryDate = Date.parse( entry[0] );

On Tue, Aug 30, 2022 at 5:52 AM Lars Vilhelmsen <l...@moviestarplanet.com> wrote:
I've tried looking as you suggested, but it seems all rows have data in [0], but I still get this error:
125125.jpg
I'm quite puzzled by the '(anonymous)' in there...
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/2ee6270a-8d9d-4a34-8690-9af16ac55c9bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages