Google apps script 如何设置允许Google Sheets使用应用程序脚本查询我的联系人的权限?

Google apps script 如何设置允许Google Sheets使用应用程序脚本查询我的联系人的权限?,google-apps-script,google-sheets,google-contacts-api,custom-function,Google Apps Script,Google Sheets,Google Contacts Api,Custom Function,我有一个谷歌表,我想检查我的联系人列表中是否已经存在电子邮件地址 我用这个函数编写了一个应用程序脚本 function isAContact(email) { if (null != ContactsApp.getContact(email)) { return 1; } return 0; } 如果我直接在GoogleApps脚本中运行此功能,在第一次运行时请求许可后,它可以正常工作 当我在GoogleSheets中调用此函数时 =isAContac

我有一个谷歌表,我想检查我的联系人列表中是否已经存在电子邮件地址

我用这个函数编写了一个应用程序脚本

function isAContact(email) {
    if (null != ContactsApp.getContact(email)) {
        return 1;
    }

    return 0;
}
如果我直接在GoogleApps脚本中运行此功能,在第一次运行时请求许可后,它可以正常工作

当我在GoogleSheets中调用此函数时

=isAContact(H4) // H4 is a cell with an email address
它抱怨调用getContact()的权限被拒绝


如何允许此电子表格使用Contacts Api?

自定义函数无法执行任何需要权限的操作:

解决办法包括: 定时触发器每5分钟将联系人列表拉入一张隐藏的工作表,并设置与之的比较

从自定义菜单触发时,将功能更改为在活动范围或预设范围内工作:
自定义函数无法执行任何需要权限的操作:

解决办法包括: 定时触发器每5分钟将联系人列表拉入一张隐藏的工作表,并设置与之的比较

从自定义菜单触发时,将功能更改为在活动范围或预设范围内工作:

Hm我错过了文档的那部分:(谢谢你的提示。我会接受你的变通建议。谢谢我错过了文档的那部分:(谢谢你的提示。我会接受你的变通建议。谢谢