-
Notifications
You must be signed in to change notification settings - Fork 15
/
createEvent.gs
31 lines (28 loc) · 1.37 KB
/
createEvent.gs
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
28
29
30
31
function createEvent() {
var cell = Browser.inputBox('Entre a célular no qual ficará o link do Zoom (ex: D4):', Browser.Buttons.OK_CANCEL);
if(cell == null){
return 0;
}
var ss = SpreadsheetApp.openById([YOUR SPREADSHEET ID]);
var sheet = ss.getSheetByName([YOUR SHEET]);
var row = cell.substr(1, 1);
cell = sheet.getRange(cell).getValue();
var title = sheet.getRange("A"+row).getValue();
var duration = sheet.getRange("C"+row).getValue();
var startTime = sheet.getRange("B"+row).getValue();
Logger.log(startTime.toString());
var location = sheet.getRange("D"+row).setValue(criaReuniao(title,startTime,duration));
Logger.log(startTime.toString());
Logger.log(location);
var guests = [YOUR GUESTS];
startTime = new Date(startTime);
startTime = new Date(startTime.setHours(startTime.getHours() + 4)); //for Brazil
var endTime = new Date(startTime);
endTime.setMinutes(endTime.getMinutes()+duration);
var event = CalendarApp.getDefaultCalendar().createEvent(title,
startTime,
endTime,
{location: location.getValue(),
guests: guests,
sendInvites: true});
}