自定义函数与附加? [英] Custom Functions with add-ons?
问题描述
我一直试图从我现有的一些Google App脚本中创建一个Google Spreadsheet插件,并且此应用脚本的一个重要部分是自定义函数。
虽然附加组件的文档并不表示这是支持的,但自定义函数的文档确实表明您可以。
https://developers.google.com/apps-script/guides/sheets/functions
通过测试,我还没有能够通过加载项获得自定义函数。有没有人知道让这个工作起作用的秘诀? b
$ b根据Eric Koleda在[Code.gs - date_add_and_subtract]( https://github.com/google/google-apps-script-samples/blob/master/date_add_and_subtract/Code.gs
)在附加组件中提供自定义功能时,它至少需要包含一个附加菜单,但目前此功能在测试模式下无法使用。注意:最初引用的页面已被删除,但日期添加和减量附加示例代码可在 https://github.com/googlesamples/apps-script/tree/master/sheets/dateAddAndSubtract 。
测试自定义函数附加组件的解决方案是私下发布附加组件,以避免Google审查未经测试的附加组件。相关问答:私人发布加载项
备注
有几个相关的GAS问题,请给它们加星标:
I've been trying to create a Google Spreadsheet plugin from some existing Google App Scripts that I have, and one important part of this app script is Custom Functions.
Though the documentation for the add-ons doesn't indicate that this is supported, the documentation for Custom Functions does indicate that you can.
https://developers.google.com/apps-script/guides/sheets/functions
Through testing, I have not once been able to get Custom Functions exposed through a add-on. Does anyone know the secret sauce to get this to work?
Answer
According to Eric Koleda in [Code.gs - date_add_and_subtract]( https://github.com/google/google-apps-script-samples/blob/master/date_add_and_subtract/Code.gs
) to make available the custom fuctions in an add-on it's required to include at least one add-on menu, but this is not working at this time on testing mode.
NOTE: The originally referred page was removed but the Date add and substract add-on sample code is available at https://github.com/googlesamples/apps-script/tree/master/sheets/dateAddAndSubtract.
The "solution" to test a custom function add-on is to publish the add-on privately so you could avoid the Google review of an untested add-on. Related Q&A: Publish an add-on privately
Remarks
There are a couple of related GAS issues, please star them:
- "Test as add-on" from standalone project to Google Sheets doesn't link custom functions
- After activating an add-on, custom functions get stuck Loading... until spreadsheet refresh
这篇关于自定义函数与附加?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!