【发布时间】:2014-11-15 10:29:04
【问题描述】:
我正在尝试为 Google 表格创建一个自定义函数作为插件。
在我的电子表格中一切正常,我也可以通过 Web chrome 商店下载它 使用 Google 提供给我的链接。
我唯一的问题是无法通过 Google 表格插件商店使自定义功能工作。
不知道我是否需要在manifest.json 文件中添加更多信息,或者执行其他操作。
我的应用程序已注册,它与外部服务没有连接,它只使用常用的 javascript 函数来拆分字符串对象。
代码结构如下:
function onOpen(e) {
SpreadsheetApp.getUi().createAddonMenu()
.addItem('Start', 'use')
.addToUi();
}
/**
* Enables the add-on on for the current spreadsheet (simply by running) and
* shows a popup informing the user of the new functions that are available.
*/
function use() {
var title = "Example";
var message = "The Function GETID is now available in this spreadsheet";
var ui = SpreadsheetApp.getUi();
ui.alert(title, message, ui.ButtonSet.OK);
}
function onInstall(e) {
onOpen(e);
}
/**
* example
* @param {string} input the example URL.
* @return The example URL.
* @customfunction
*/
function GETID(URL) {
return 'example '+URL;
}
【问题讨论】:
标签: javascript google-apps-script google-sheets add-on chrome-web-store