Skip to content

Instantly share code, notes, and snippets.

@woodwardtw
Created March 22, 2016 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woodwardtw/1770c4f6199e4ffc41b9 to your computer and use it in GitHub Desktop.
Save woodwardtw/1770c4f6199e4ffc41b9 to your computer and use it in GitHub Desktop.
function multiCalEventMaker () {
var fromSS = 'Big Events, Small Events, Tiny Events'; //get calendars you want, could be checkbox entries from Google Form
fromSS = fromSS.replace(/,\s+/g, ',').toLowerCase(); //gets rid of the space before the comma which ruined my life for too long
Logger.log(fromSS); //
var calNames = fromSS.split(",");
//loops through however many calendars you set above
for (i = 0; i <calNames.length; i++) {
var calName = calNames[i];
var calId = CalendarApp.getCalendarsByName(calName)[0]; //you'd change the next stuff to integrate whatever variables you want
var event = CalendarApp.getCalendarById(calId.getId()).createAllDayEvent('Magic Stuff',
new Date('March 25, 2016'),
{location: 'The Moon'});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment