-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathCreate_Events.js
More file actions
27 lines (22 loc) · 862 Bytes
/
Copy pathCreate_Events.js
File metadata and controls
27 lines (22 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function create_Events(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Calendar_Events");
var last_row = sheet.getLastRow();
var data = sheet.getRange("A1:E" + last_row).getValues();
var cal = CalendarApp.getCalendarById("aryanirani123@gmail.com");
//Logger.log(data);
for(var i = 0;i< data.length;i++){
// index 0 = Name of the Event
// index 1 = Start Time of the Event
// index 2 = End Time of the Event
// index 3 = Location of the Event
// index 4 = Description of the Event
// index 5 = Attendess of the Event
var Events = cal.createEvent(data[i][0],
new Date(data[i][1]),
new Date(data[i][2]),
{location: data[i][3], description : data[i][4]});
//Logger.log('Event ID: ' + event.getId());
}
Logger.log("Events have been added to the calendar");
}