首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spreadsheet add-on清单时区

Spreadsheet add-on清单时区
EN

Stack Overflow用户
提问于 2018-09-18 04:01:19
回答 1查看 494关注 0票数 1

所以我希望我的插件在它的函数中使用用户时区,我如何在清单中设置它?

代码语言:javascript
复制
{
  "oauthScopes": [
    "https://www.googleapis.com/auth/gmail.readonly",
    "https://www.googleapis.com/auth/gmail.send",
    "https://www.googleapis.com/auth/spreadsheets",
    "https://www.googleapis.com/auth/script.container.ui",
    "https://www.googleapis.com/auth/script.scriptapp",
    "https://www.googleapis.com/auth/userinfo.email",
    "https://www.googleapis.com/auth/script.storage"
  ],
  "dependencies": {
  },
  "exceptionLogging": "STACKDRIVER",
  "timeZone": "GMT"
}

我的意思是addon可能会被来自美国或印度的用户使用,他们应该根据自己的时区运行addon。

EN

回答 1

Stack Overflow用户

发布于 2018-09-18 14:04:56

您只需要在清单文件中使用以下作用域来检索用户的时区。

代码语言:javascript
复制
https://www.googleapis.com/auth/spreadsheets

然后使用SpreadsheetApp服务获取当前电子表格的默认时区,该时区很可能也是用户的时区。

代码语言:javascript
复制
var ss = SpreadsheetApp.getActiveSpreadsheet();
Logger.log(ss. getSpreadsheetTimeZone());
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52374909

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档