我有一个下面的脚本。它将事件从Google日历中提取出来,变成一系列标题。
我一直希望将getName()
字符串而不是getguestlist()
(第18行)集成在其中。我是脚本编写的新手,仅替换掉它们是行不通的。
任何人都可以帮助让我知道如何进行此工作,以便返回个人姓名(或至少是电子邮件)。
function GoogleCalendarExport() {
var mycal = "email@email.com";
var cal = CalendarApp.getCalendarById(mycal);
var events = cal.getEvents(new Date("September 01 , 2018 00:00:00 GMT"), new Date("March 01, 2019 23:59:59 GMT"), {
search: '-project123'
});
var sheet = SpreadsheetApp.getActiveSheet();
var header = [
["Calendar Address", "Event Title", "Event Location", "Event Start", "Event End", "Calculated Duration", "Visibility", "Date Created", "Last Updated", "MyStatus", "Created By", "All Day Event", "Recurring Event", "Guest List", "Event Type", "Activity Category", "School/College in Attendance", "Year Group/Audience Present", "Number of Prospectus", "Approximate number in the audience if a talk", "Approximate number spoken to", "Notes"]
]
var range = sheet.getRange(1, 1, 1, 22);
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].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(), events[i].getGustlist(), events[i].getDescription()]
];
var range = sheet.getRange(row, 1, 1, 15);
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');
};
}