【发布时间】:2020-10-18 07:01:59
【问题描述】:
我试图将一些自定义脚本添加到 Google 表格中。但是,即使按照 GoogleCodeLabs 指南中给出的相同步骤进行操作,也会遇到很多问题。
这是我的代码 main.gs 文件
function doGet() {
return HtmlService.createHtmlOutputFromFile('Index');
}
function doSomething() {
Logger.log('I was called!');
}
index.html 文件
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script>
google.script.run.doSomething();
</script>
</head>
<body>
</body>
</html>
appsscript.json 文件
{
"timeZone": "Asia/Kolkata",
"dependencies": {
},
"webapp": {
"access": "MYSELF",
"executeAs": "USER_DEPLOYING"
},
"exceptionLogging": "STACKDRIVER",
"oauthScopes": ["https://www.googleapis.com/auth/spreadsheets.readonly",
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/spreadsheets",
"https://www.googleapis.com/auth/script.container.ui"],
"runtimeVersion": "V8"
}
我也在部署它并进行每一个小的更改,但即使按照指南中提到的方式进行操作,我也无法记录输出。 我错过了什么?
【问题讨论】:
-
记录器确实需要很长时间才能在 V8 中显示结果,所以我发现使用视图/执行很快
-
在脚本执行中可以查看日志。转到脚本仪表板并查看那里的脚本执行日志。
标签: google-apps-script google-sheets