如何编辑以下代码,以便能够在同一电子表格中提取多个Google日历?我似乎无法弄清楚如何包含多个日历。我也不想覆盖任何人的日历事件。它们都应该填充在同一张纸中。
function export_gcal_to_gsheet_alex(){
var mycal = "alex@testtest.com" ;
var cal = CalendarApp.getCalendarById(mycal);
var events = cal.getEvents(new Date("December 2, 2018 00:00:00 CST"), new Date("December 10, 2018 23:59:59 CST"), {search: '-project123'});
var sheet = SpreadsheetApp.getActiveSheet();
var header = [["Calendar Address", "Event Title", "Event Description", "Event Location", "Event Start", "Event End", "Calculated Duration", "Visibility", "Date Created", "Last Updated", "MyStatus", "Created By", "All Day Event", "Recurring Event"]]
var range = sheet.getRange(1,1,1,14);
range.setValues(header);
for (var i=0;i<events.length;i++) {
var row=i+2;
var myformula_placeholder = '';
var details=[[mycal,events[i].getTitle(), events[i].getDescription(), events[i].getLocation(), events[i].getStartTime(), events[i].getEndTime(), myformula_placeholder, ('' + events[i].getVisibility()), events[i].getDateCreated(), events[i].getLastUpdated(), events[i].getMyStatus(), events[i].getCreators(), events[i].isAllDayEvent(), events[i].isRecurringEvent()]];
var range=sheet.getRange(row,1,1,14);
range.setValues(details);
var cell=sheet.getRange(row,7);
cell.setFormula('=(HOUR(F' +row+ ')+(MINUTE(F' +row+ ')/60))-(HOUR(E' +row+ ')+(MINUTE(E' +row+ ')/60))');
cell.setNumberFormat('.00');
}
}