大家好我想在下周展示所有活动标题你能否帮助我仍然有错误
function getevents() {
var sheet = mySpread.getActiveSheet();
var now = new Date();
var oneWeekFromNow = new Date(now.getTime() + (7 * 24 * 60 *60 * 1000));
var events = CalendarApp.getDefaultCalendar().getEvents(now, oneWeekFromNow).getTitle();
var myEvents = [];
for (var i = 0; i < events.length; i++) {
var tableauEvents = [];
tableauEvents.push(events[i].getEvents(now, oneWeekFromNow))
myEvents.push(tableauEvents);
sheet.getRange(2, 2, myEvents.length, myEvents[0].length).setValues(myEvents)
SpreadsheetApp.flush()
}
}
答案 0 :(得分:0)
如果有人需要
,这就是结果function getevents() {
var cal = CalendarApp.getDefaultCalendar();
var sheet = SpreadsheetApp.getActiveSheet();
var now = new Date();
var oneWeekFromNow = new Date(now.getTime() + (7 * 24 * 60 *60 * 1000));
var events = cal.getEvents(now, oneWeekFromNow);
var myEvents = [];
for (var i = 0; i < events.length; i++) {
var tableauEvents = [];
tableauEvents.push(events[i].getTitle())
myEvents.push(tableauEvents);
sheet.getRange(2, 2, myEvents.length, myEvents[0].length).setValues(myEvents)
SpreadsheetApp.flush()
}
}