Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Google App Script - CalendarApp
function CalendarTest() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var index = 2;
var lastRow = sheet.getLastRow();
for (;index <= lastRow; index++){
var title = sheet.getRange(index, 1, 1, 1).getValue();
var startTime = sheet.getRange(index, 2, 1, 1).getValue();
var endTime = sheet.getRange(index, 3, 1, 1).getValue();
var description = sheet.getRange(index, 4, 1, 1).getValue();
var location = sheet.getRange(index, 5, 1, 1).getValue();
var guests = sheet.getRange(index, 6, 1, 1).getValue();
var sendInvites = true;
var calendar = CalendarApp.getCalendarById("YOUR-EMAIL-ID-HERE@YOUR-ORG-NAME.com").createEvent(title, startTime, endTime,
{description: description, location: location, guests: guests, sendInvites: sendInvites });
}// End of for Loop
}// End of CalendarTest Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment