代码之家  ›  专栏  ›  技术社区  ›  Arjun

从Google Sheet运行自定义函数时没有显示权限错误

  •  0
  • Arjun  · 技术社区  · 3 年前

    我正在尝试整合谷歌工作表和日历。我已经编写了一个函数,可以将事件添加到谷歌日历中,但是当我试图从 cell 使用 custom function 它显示了这个错误

    Exception: The script does not have permission to perform that action. Required permissions: (https://www.googleapis.com/auth/calendar || https://www.googleapis.com/auth/calendar.readonly || https://www.google.com/calendar/feeds)

    我已经在清单文件中给出了上述许可。这是我的清单:

    `

    "https://www.googleapis.com/auth/calendar",
    "https://www.googleapis.com/auth/calendar.readonly",
    "https://www.google.com/calendar/feeds",
    "https://www.googleapis.com/auth/spreadsheets.currentonly",
    "https://www.googleapis.com/auth/spreadsheets"
    

    ],`

    问题发生在这条线上 let cal=CalendarApp.getCalendarById("ID");

    如何解决这个问题,请帮忙!

    1 回复  |  直到 3 年前
        1
  •  2
  •   Cooper    3 年前

    自定义功能不包括日历

    functionality available to Custom Functions 它不包括日历。即使将作用域添加到清单中,如果它不在链接列表中,那么它对单元格或自定义函数不可用,也没有什么区别。将其作为标准脚本编写,并从菜单中调用。