我想与用户共享Google表格,以便他们可以在其日历中添加多日全天活动。由于谷歌不提供这样做的功能,我厌倦了各种解决方法。 createEvent(title,startTime,endTime)并不完美,因为它使用并显示日期时间, createEventFromDescription(描述)不允许元数据,如描述,所以我尝试使用高级日历服务。 从我读过的内容启用高级日历服务后,您应该可以像使用App脚本的内置日历服务一样使用Google Calendar API。如果我在一个图纸脚本编辑器中运行这个内置函数,它可以工作,我可以制作一个表格的副本,通过电子邮件发送给其他人,他们也可以运行功能
var event = CalendarApp.getDefaultCalendar().createEvent('Apollo 11 Landing', new Date('July 20, 1969 20:00:00 UTC'), new Date('July 20, 1969 21:00:00 UTC'), {location: 'The Moon'}); Logger.log('Event ID: ' + event.getId());
如果我使用高级日历服务和使用下面的代码基本上是他们的例子,我可以在脚本编辑器中运行该功能,它的工作原理是,但如果我复制表单并将它发送给其他人尝试,我会得到错误“Project(number)is not找到并且不能用于API调用“。任何人都可以看到我做错了什么。Google Apps脚本 - 高级日历服务
function createEvent() {
var calendarId = 'primary';
var event = {
summary: 'Lunch Meeting',
location: 'The Deli',
description: 'To discuss our plans for the presentation next week.',
start: {
date: "2017-05-21"
},
end: {
date: "2017-05-24"
},
attendees: [
{email: '[email protected]'},
{email: '[email protected]'}
],
// Red background. Use Calendar.Colors.get() for the full list.
colorId: 11
};
event = Calendar.Events.insert(event, calendarId);
Logger.log('Event ID: ' + event.getId());
}
我的意思是感谢。如果我不能让高级日历服务工作 – slanton
我想我的问题确实是......可以共享一张具有使用高级日历服务的脚本的工作表,只需制作工作表副本即可。 – slanton
答案是肯定的,但是与之分享的人也必须启用Calendar API – slanton