Skip to content

Instantly share code, notes, and snippets.

Created February 8, 2018 18:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/279f645e39fc57bbc5ddc48e657cfdc4 to your computer and use it in GitHub Desktop.
Save anonymous/279f645e39fc57bbc5ddc48e657cfdc4 to your computer and use it in GitHub Desktop.
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