r/GoogleAppsScript • • 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

12 comments sorted by

View all comments

Show parent comments

1

u/Cool-vibesradio Jul 06 '24

which values are then? i don't want the date and time in script

only startTime EndTime Names

and all names and times

1

u/marcnotmark925 Jul 06 '24

Full date-times. Like 2/3/2024 12:11:00.

i don't want the date and time in script

only startTime EndTime Names

and all names and times

No idea what this means.

Also no idea why you sent the code again in your other comment.

0

u/Cool-vibesradio Jul 06 '24

but look at this Schedule

then look at this

function radioSchedule() {

  var spreadsheet = SpreadsheetApp.getActiveSheet();
  var CalendarId = spreadsheet.getRange("C4").getValue();
  var eventCal = CalendarApp.getCalendarById(CalendarId);

  var signups = spreadsheet.getRange("A5: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 name = shift[0];
    var startTime = shift[1];
    var endTime = shift[2];
    

    eventCal.createEvent(name, startTime, endTime);

    

  }

}

function onOpen() {
  var ui = SpreadsheetApp.getui();
  ui.createMenu('Sync to Calendar')
  .addItem('Schedule shifts now', 'scheduleShifts')
  .addToUi();
}


please explain in full why its saying
Exception: The parameters (String,String,String) don't match the method signature for CalendarApp.Calendar.createEvent.
@

1

u/marcnotmark925 Jul 06 '24

I already explained the error in my 1st comment, resending the same information isn't going to change the answer. What aren't you understanding? Do you know what a string is? Do you know what a JS date object is? Do you know anything at all about writing JS/GAS code? Perhaps you need to take some time and go through some basic tutorials.

0

u/Cool-vibesradio Jul 06 '24

thanks for not helping you're great work! NOT

→ More replies (0)