Gas - Calendar addevents

The following is to push Events from a google sheet to google calendar script:

function addEvents() {
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var lr = ss.getLastRow();
var cal = CalendarApp.getCalendarById(“c_3qjs8u1i5cu0re1coi8ageo51s@group.calendar.google.com”);

var data = ss.getRange(“A2:E” + lr).getValues();

for(var i = 0;i<data.length;i++){

cal.createEvent(data[i][0], data[i][1], data[i][2], {location: data[i][3], description:data[i][4] } )

}

}

You have to make sure the sheet is in order of Event Name, Start Date, End Date, Location and Description to use this script or change the second value after data in CreateEvent.

If you don’t want the fuss of using Google App Script , you can use IFTTT which is the most amazing tool for automation.

Updated Script

    function addEvents() {    var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();    var lr = ss.getLastRow();

    var data = ss.getRange(“A2:E” + lr).getValues();
    for(var i = 0;i<data.length;i++){
   var cal = CalendarApp.getCalendarById(“dsknjlrd19apqtbgastkc1pnpg@group.calendar.google.com”).createAllDayEvent(data[i][3],    new Date(data[i][0]));
    }
    }

2 thoughts on “How to Bulk add events to calendar | Kanza Akhwand”

Comments are closed.