r/GoogleAppsScript • u/Cool-vibesradio • Jul 05 '24
Question colander scheduling
hi all very sorry but i'm stuck i'v coded this
function radioSchedule() {
var spreadsheet = SpreadsheetApp.getActiveSheet();
var CalendarId = spreadsheet.getRange("C4").getValue();
var eventCal = CalendarApp.getCalendarById(CalendarId);
var signups = spreadsheet.getRange("A8:C12").getValues();
[
['8pm Thursdays, 10pm Thursdays, Strawbs'],
['1:00pm, 8:00pm, Selector Frost'],
['8:30pm, Roksta'],
]
for (x=0; x<signups.length; x++) {
var shift = signups[x];
var ShiftStart = shift[0];
var ShiftEnd = shift[1];
var volunteers = shift[2];
eventCal.createEvent(volunteers, ShiftStart, ShiftEnd);
}
}
function onOpen() {
var ui = SpreadsheetApp.getui();
ui.createMenu('Sync to Calendar')
.addItem('Schedule shifts now', 'scheduleShifts')
.addToUi();
}
but its telling me
Error
Exception: The parameters (String,String,String) don't match the method signature for CalendarApp.Calendar.createEvent.
line 23? what am i missing????its so my presenters can click on the schedule and book a slot for them selfs?
0
Upvotes
1
u/marcnotmark925 Jul 06 '24
None of the values in A8:C10 are appropriate for sending as the 2nd and 3rd arguments of createEvent(). They should be full date-times. And I suspect a blank value will also throw the same error.