I have very limited experience with Google Apps Scripts, but have successfully modified the code from https://developers.google.com/apps-script/quickstart/forms to meet almost all of my needs.
Need to know how to view on my calendar all guests who sign up for a date.
I have investigated CalendarApp options, but can't get anything formatted to work so that the name of anyone who completes the Google Form for a specific date shows up on my calendar on that date -- maybe as a guest or attendee?
var cal = CalendarApp.getOwnedCalendarById(XXX);
for (var i = 1; i < values.length; i++) {
var session = values[i];
var title = session[0];
var start = joinDateAndTime_(session[1], session[2]);
var end = joinDateAndTime_(session[1], session[3]);
var options = {location: session[4], sendInvites: true};
var event = cal.createEvent(title, start, end, options)
.setGuestsCanSeeGuests(false);
session[5] = event.getId();
}
range.setValues(values);
var schedule = {};
for (var i = 1; i < values.length; i++) {
var session = values[i];
var day = session[1].toLocaleDateString();
var time = session[2].toLocaleTimeString();
if (!schedule[day]) {
schedule[day] = {};
}
if (!schedule[day][time]) {
schedule[day][time] = [];
}
schedule[day][time].push(session[0]);
}
// Create the form and add a multiple-choice question for each timeslot.
var form = FormApp.create('2019-2020 Semester 1 Sign up');
form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());
form.addTextItem().setTitle('Name').setRequired(true);
form.addTextItem().setTitle('Email').setRequired(true);
form.addTextItem().setTitle('Phone Number').setRequired(false);
for (var day in schedule) {
var header = form.addSectionHeaderItem().setTitle('Odysseys on ' + day);
for (var time in schedule[day]) {
var item = form.addMultipleChoiceItem().setTitle(time + ' ' + day)
.setChoiceValues(schedule[day][time]);
}
}
}
var title = name + ": " + session[0];
; – sinarahenebacreateEvent()
or usingaddGuest()
– sinaraheneba