google-apps-script - 自定义函数和重新计算

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

我有一个自定义函数,它接受三个范围名称作为输入参数。当这些范围内的单元格值发生变化时,函数输出保持不变。这是平台的“功能”。

是否有任何正确的方法(到目前为止)使 Google Sheets 中的自定义函数动态重新计算?我知道人们已经尝试添加 now()作为一个参数,它曾经不顾需要地不断重新计算。 (现在被新的床单挡住了。)有没有人找到满意的解决方案?

最佳答案

使自定义函数重新计算的正确方法是更改​​它的参数。关于使用 NOW() 和其他类似的内置函数作为自定义函数的参数,来自 Custom functions in Google Sheets

Custom function arguments must be deterministic. That is, built-in spreadsheet functions that return a different result each time they calculate — such as NOW() or RAND() — are not allowed as arguments to a custom function. If a custom function tries to return a value based on one of these volatile built-in function, it will display Loading... indefinitely.



来自 comment来自 Mogsdad这个答案:

In fact, rather than "Loading...", this will display an #ERROR!, This function is not allowed to reference a cell with NOW(), RAND(), or RANDBETWEEN()

关于google-apps-script - 自定义函数和重新计算,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25163243/

相关文章:

javascript - Google 脚本运行时优化

keras - 在 keras 回调中使用带有自定义参数的自定义函数

google-apps-script - 在自定义函数中使用内置函数

filtering - 如何查询功能Google Spreadsheet - 基于多个条件的数据过滤(一次检查多列)

google-apps-script - 自定义函数抛出 "You do not have the permission required to setValue"错误

javascript - Google 脚本数字格式错误

javascript - Google Sheet导入Ljava.lang.Object错误

facebook-graph-api - 在Google Apps脚本网络应用中使用Facebook API?

google-apps-script - 如何为域部署 Google Apps 脚本?

google-apps-script - 如何解决 Google App Script 中附加组件的时间触发限制?