Calendar Reservation Project
This project is for beginners. It contains only a single function, and that was just so I could have the function triggered on form submission. This project lets you dip your toe into how useful Google Apps Script can truly be.
Once you have conquered this, I recommend checking out my full calendar reservation project. That project enables us to add many more features to the reservation program.
[code]</pre>
// Simple Claendar Reservations
// Kurt Kaiser, 2018
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
var lastRow = sheet.getLastRow();
var calendar = CalendarApp.getCalendarById("e6i9tfp012mt4m5ic81v9lisp0@group.calendar.google.com");
function makeCalendarEvent() {
// Get Spreadsheet Info
var name = sheet.getRange(lastRow, 2).getValue();
var startDate = new Date(sheet.getRange(lastRow, 4).getValue());
var endDate = new Date(startDate);
var startTime = sheet.getRange(lastRow, 5).getValue();
var endTime = sheet.getRange(lastRow, 6).getValue();
// Update date time
startDate.setHours(startTime.getHours());
startDate.setMinutes(startTime.getMinutes());
endDate.setHours(endTime.getHours());
endDate.setMinutes(endTime.getMinutes());
// Make calendar event
var event = calendar.createEvent(
name,
startDate,
endDate
)
}
<pre>
[/code]
you absolute legend! Just found your youtube tutorial on this and its exactly the functionality I’m looking to create. I’ve minimal coding experience but am going to try to give this a go today. Wish me luck!