Calendar Reservation Project

My new project uses a data submitted to a Google Form to create events on a calendar. The Google Form asks for the person’s name, reason for the visit and allows them to select the day and time for their appointment. The code uses an on Form submission trigger, it takes the day and time of the requested appointment and adds it to a specified calendar. The person’s name is used as the title for the new event.

I will be posting a video tutorial for this project shortly.

// Calendar Reservation Project
// Kurt Kaiser, 2017
// All rights reserved

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var lastRow = sheet.getLastRow();
var lastColumn = sheet.getLastColumn();

// Calendar to output requests
var calendar = CalendarApp.getCalendarById(‘’);

// Creates an object from the last form submission
function getSubmission(){
this.timestamp = sheet.getRange(lastRow, 1).getValue(); = sheet.getRange(lastRow, 2).getValue();
this.reason = sheet.getRange(lastRow, 3).getValue(); = new Date(sheet.getRange(lastRow, 4).getValue());
this.time = sheet.getRange(lastRow, 5).getValue();
return this;

// Creates a calendar event using the submitted data
function updateCalendar(request){;;
var endTime = new Date(;
endTime.setHours(endTime.getHours() + 1);
var event = calendar.createEvent(,,


// ————–Main————–
function main(){
var request = getSubmission();