testing - 测试 Google 表格插件

标签 testing google-apps-script google-sheets google-apps-script-addon

我在脚本编辑器中使用 Code.gsIndex.html 创建了一个插件。我选择 Publish ==> Test as add-on... 然后在对话框中选择另一个 google 表格。单击 Test 打开该 google 工作表,但我没有看到任何应由 index.html=myFunction() 制作的任务 Pane 在单元格中也不起作用。

有人知道如何测试这个插件吗?

编辑 1: Code.gs:

function myFunction() {
  return 100
}

Index.html:

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    super add-on
  </body>
</html>

最佳答案

您绝对可以在其他工作表中测试侧边栏插件。您需要使用以下脚本。此外,请确保将安装配置选择为已安装并启用

function onOpen() {
   var html = HtmlService.createHtmlOutputFromFile('index') //your html page name
      .setTitle('My custom sidebar')
      .setWidth(300);
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .showSidebar(html);
}

目前,自定义功能无法在测试插件模式下运行。已经为此报告了一个问题,Google 已接受该问题。 Check this .

关于testing - 测试 Google 表格插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45888364/

相关文章:

testing - 通过 CircleCI 同时运行 Phpunit 和 JS 测试

testing - 测试 Go 时如何跨包共享设置和拆卸方法?

testing - 由于 testhost.dll,Azure-DevOps 管道失败

google-apps-script - 为什么 Google Apps 脚本仅在脚本执行结束后才将分页符和数据插入表中?

google-apps-script - 电子表格中特定工作表的 onEdit 触发器?

google-sheets - 在过滤器公式中使用 Unique

检查 Android Espresso NoMatchingViewException

google-apps-script - Google Apps 脚本中 JDBC 连接的 URL 参数中的 SSL 属性

google-apps-script - 如何按顺序执行Google Apps脚本中的多个函数?

Java GData Spreadsheets API 获取 Feed 失败