Google Calendar and Appointments

Like some of my favorite people, I’ve been playing around with Google Scripts in earnest this year to make my teaching work easier. I did this most recently with Google Calendar.

You may or may not know that you can set up appointment slots on a calendar. This is really nice to for others to sign up for appointment times. Google provides a appointment sign up page, lets others book the slots out of those available, and moves booked slots onto your calendar. The only problem is that it requires that those booking appointments have a Google account and sign in. You can’t have a public appointments page that lets any non-Google user view and book a slot. For the purpose of setting up parent conferences, this is a no-go.

You can, however, have a public calendar page that does not require sign-in. The closest way to implement the appointment function would be to show a bunch of appointment slots on that public calendar and have parents ask for the slot that works best through email.

I wrote a script to make these slots. You enter the calendar ID, the start time for the window for appointment slots, the meeting length in minutes, and how many slots to make. The script does the rest.

function addAppointmentSlotsToCalendar(){
  
 var parentCalendarID = "enterCalendarIDHere"
 var parentCalendar = CalendarApp.getCalendarById(parentCalendarID);
 var currentDate = "October 21 2019" 
  var eventTitle = "Appointment Available"
  var startTime = "8:30"
  var duration = 15 //minutes
  var numberOfSlots = 8
  
  
  var startDateTime = new Date(currentDate + " " + startTime)
  var endDateTime = new Date(startDateTime.getTime() + duration*60000)
  
  var currApptTimeDate = startDateTime
  
  for(var i = 0;i<numberOfSlots;i++){
    parentCalendar.createEvent(eventTitle, currApptTimeDate, endDateTime, {description: 'This appointment time is available for meeting with Mr. Weinberg.'})
    currApptTimeDate = endDateTime
    endDateTime = new Date(currApptTimeDate.getTime() + duration*60000)
    
  }

}

I learned some important things that didn't occur to me until parents started emailing me about the times.

The calendar needs to not only be public, but the event details need to be visible. Otherwise, the public calendar shows all of the slots, but they appear as 'busy'. This is in the calendar settings here:

The really nice feature that I didn't realize would work until I started receiving requests for times is filling appointments. All I need to do is change the calendar for the event from the public version to my personal one. This removes the slot from the public calendar and adds it to my own schedule.

I've had some fun figuring out how to use automation like this to manage my work this year. There is a lot built into Google Scripts that makes repetitive processes much easier, particularly for the sorts of things that teachers do all the time. I encourage you to find something that you do that might be improved by a script like this and make it a personal challenge to figure out how to do it.