【问题标题】:Can we use CalendarApp to see events from a non-Google calendar that we are subscribed to (ex. Trello calendar)?我们可以使用 CalendarApp 查看我们订阅的非 Google 日历(例如 Trello 日历)中的事件吗?
【发布时间】:2020-02-21 03:48:33
【问题描述】:

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

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

作为参考,这里是日历 ID:mp9si8iqi6uop4a20pr0r1v000dc9pcu@import.calendar.google.com。格式与以 @group.calendar.google.com 结尾的 Google 日历略有不同。

我们是否能够从这些导入的日历中访问日历信息?我也尝试了.getCalendarsByName(calendarName),但没有成功,但还有其他方法可以查看这些数据并将其包含在我们的日历电子表格中吗?任何帮助表示赞赏!

编辑(按要求)

如果我不清楚,我尝试了以下方法:

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

只有这个由 Trello 管理的日历存在问题

【问题讨论】:

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

标签: google-apps-script google-sheets calendar trello


【解决方案1】:

您绝对可以从导入的日历中获取信息。请尝试使用以下代码:

function myFunction() {
  var calendarId = "YOUR_CALENDAR_ID";
  var cal = CalendarApp.getCalendarById(calendarId);
  Logger.log(cal.getName());
  Logger.log(cal.getDescription());
  Logger.log(cal.getTimeZone());
  Logger.log(cal.getColor());
}

运行它,然后导航到查看>日志。您应该能够看到日历的信息。我建议您也尝试以下方法:

使用“试用此 API”功能

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-03
    • 1970-01-01
    • 2023-02-17
    • 1970-01-01
    • 2016-06-04
    • 1970-01-01
    相关资源
    最近更新 更多