【发布时间】:2020-11-04 12:20:49
【问题描述】:
我有一个工作表文件,当单击按钮时会创建一个日历事件。日历事件基于用户输入的截止日期、脚本创建的开始日期、输入的位置和输入的描述,这些都来自电子表格中的某些单元格。问题是当我去日历时,事件在截止日期前一天(或截止日期的开始)结束,我希望它显示整个截止日期。例如,如果我在电子表格中输入了 7 月 17 日的截止日期,那么当我创建日历事件时,它只会运行到 16 日。有没有办法让事件安排到一天结束,或者有一种简单的方法可以在脚本中将结束日期偏移一天。
var Description = sheetTemplate.getRange('B12').getValue(); //gets discription from Cell B12
var Location = sheetTemplate.getRange('C5') .getValue(); //gets location of work order from cell C5
var StartDate = sheetTemplate.getRange('C4').getValue(); //Start Date from Cell C4
var DueDate = sheetTemplate.getRange('E5').getValue(); //Gets Due Date From Cell E5
//This portion of the code schedules the WO on the calendar//
var eventCal = CalendarApp.getCalendarById("XXXXX") ;//Get the Maintenance Calendar
var options = { 'location': Location,
'description':Description
} //sets event details
var WOevent = eventCal.createAllDayEvent(WOname,StartDate,DueDate,options);//creates a calendar event
WOevent.setColor('10') // sets the color of the calendar event to green
【问题讨论】:
标签: google-apps-script google-sheets google-calendar-api