如何在谷歌电子表格中添加"自定义功能帮助". - 不是脚本编辑器

edd*_*son 6 google-sheets google-apps-script custom-function

可以在谷歌电子表格中添加"自定义功能帮助"吗?即如果我在电子表格单元格中键入= sum,我会得到浮动帮助文本,有没有办法用自定义函数执行此操作?

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

看起来这些只能在脚本编辑器中使用.它有一种添加文档的方式,因此它出现在电子表格中.

Mog*_*dad 7

此功能已于2014年5月添加,之前的第2475期已关闭.

Google文档提供示例都可以,但您可以使用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() );
}
Run Code Online (Sandbox Code Playgroud)

截图

我在博客中详细介绍了更多细节和示例.