google-apps-script - 如何将 "custom function help"添加到谷歌电子表格。 - 不是脚本编辑器

标签 google-apps-script google-sheets custom-function

可以将“自定义功能帮助”添加到谷歌电子表格吗?
即如果我在电子表格单元格中输入 =sum,我会得到 float 帮助文本,
有没有办法用自定义函数来做到这一点?

谷歌应用程序脚本中的文档是使用 JSDoc 创建的 http://en.wikipedia.org/wiki/JSDoc
样式(JavaDoc 之类的)注释。
如此处所述
https://developers.google.com/apps-script/guide_libraries?hl=en#guidelines

看起来这些只能在脚本编辑器中工作。它有一种添加文档的方法,因此它会出现在电子表格中。

最佳答案

此功能于 2014 年 5 月添加,之前的 Issue 2475已被关闭。

examples given in Google's Documentation没问题,但是您可以使用 jsdoc 信息做的比它们显示的更多。

例如:

/**
 * Return the time that the referenced cell or range was last changed.
 * Initial use shows current time.
 *
 * @param {Sheet3!B32}  reference  Cell or range to monitor.
 * @returns                        The time the reference was last changed.
 * @customfunction
 */
function lastModified( reference ) {
  // Surprise - we don't actually care what has changed!
  return( new Date() );
}

screenshot

我在 my blog 中详细介绍了这一点和示例。 .

关于google-apps-script - 如何将 "custom function help"添加到谷歌电子表格。 - 不是脚本编辑器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15015373/

相关文章:

google-apps-script - 如何将 Google 电子表格图表上传到 Slack channel

json - 自动更新 ImportJSON

javascript - 用于将图片插入工作表(Google 应用程序脚本)的 blob 大小是否有限制?

javascript - 更高效的 'remove duplicates' 函数

google-apps-script - Google Sheets 如何确保在使用按钮运行脚本之前完成字段更改

google-sheets - 谷歌电子表格中的 "constant"?

python - Keras 中的 RMSE/RMSLE 损失函数

google-apps-script - 选择列的最后一个值

google-apps-script - 将图像从驱动器添加到工作表

google-apps-script - 使用 Apps 脚本访问 tumblr API 时遇到问题