Google apps script 我们可以使用CalendarApp查看订阅的非谷歌日历(例如Trello日历)中的事件吗?

Google apps script 我们可以使用CalendarApp查看订阅的非谷歌日历(例如Trello日历)中的事件吗?,google-apps-script,google-sheets,calendar,trello,Google Apps Script,Google Sheets,Calendar,Trello,一直在使用CalendarApp帮助将来自不同帐户的多个Google日历聚合到一个格式良好的电子表格中。但是,我们希望将不仅仅是这些日历合并到系统中,并且从订阅的导入日历中检索数据时遇到了问题 此日历来自Trello(使用通电创建基于到期日的日历),它提供了一个URL供我们在Google上订阅。当我尝试使用相同的CalendarApp.getCalendarById(calendarId)时,它似乎无法访问事件数据并返回null 以下是日历id供参考:mp9si8iqi6uop4a20pr0r1

一直在使用
CalendarApp
帮助将来自不同帐户的多个Google日历聚合到一个格式良好的电子表格中。但是,我们希望将不仅仅是这些日历合并到系统中,并且从订阅的导入日历中检索数据时遇到了问题

此日历来自Trello(使用通电创建基于到期日的日历),它提供了一个URL供我们在Google上订阅。当我尝试使用相同的
CalendarApp.getCalendarById(calendarId)
时,它似乎无法访问事件数据并返回
null

以下是日历id供参考:mp9si8iqi6uop4a20pr0r1v000dc9pcu@import.calendar.google.com. 该格式与以@group.calendar.Google.com结尾的谷歌日历略有不同

我们是否能够从这些导入的日历中访问日历信息?我也尝试了
.getCalendarsByName(calendarName)
,但运气不好,但是是否有其他方法可以查看此数据并将其包含在我们的日历电子表格中?感谢您的帮助

编辑(按要求) 如果我不清楚,我会尝试以下方法:

calendarId = "mp9si8iqi6uop4a20pr0r1v000dc9pcu@import.calendar.google.com";
CalendarApp.getCalendarById(calendarId);
//and
calendarName = "Collab, Events & Special Buy";
CalendarApp.getCalendarsByName(calendarName);

只有Trello管理的日历存在问题,您才能从导入的日历中获得信息。请尝试使用以下代码:

函数myFunction(){
var calendarId=“您的日历ID”;
var cal=CalendarApp.getCalendarById(calendarId);
Logger.log(cal.getName());
Logger.log(cal.getDescription());
Logger.log(cal.getTimeZone());
Logger.log(cal.getColor());
}
运行它,然后导航到查看>日志。您应该能够看到日历的信息。我建议您也尝试以下方法:

calendarId = "mp9si8iqi6uop4a20pr0r1v000dc9pcu@import.calendar.google.com";
CalendarApp.getCalendarById(calendarId);
//and
calendarName = "Collab, Events & Special Buy";
CalendarApp.getCalendarsByName(calendarName);
使用“试用此API”功能
  • 列出您所有的日历并找到您想要的日历。您应该能够找到它,并提取它的id

  • 列出日历上的活动。您只需设置刚刚检索到的
    calendarId
    值并执行即可。您应该能够查看日历上的事件


请添加您迄今为止尝试的代码hey@ChucksKegscom我刚刚发布了一个答案。如果您有任何问题,请告诉我。干杯谢谢@carlesgg97!这次我们找到了日历!