我想使用脚本将以活动工作簿标签命名的事件添加到我的日历中。该活动将在未来两周开始。我该怎么做?
我目前的代码:
function myFunction() {
var name = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName();
var event = CalendarApp.getDefaultCalendar().createAllDayEvent('Check on status of re:'+name+' application',
new Date('July 20, 1969')); //this should be two weeks from now
Logger.log('Event ID: ' + event.getId());
}
答案 0 :(得分:0)
function myFunction() {
var name = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName();
var date = new Date();
var d = new Date(date.getTime()+14*3600000*24);
var event = CalendarApp.getDefaultCalendar().createAllDayEvent('Check re:'+name+' application',
d); //this should be two weeks from now
}