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

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

有没有正确的方法(截至目前)在Go​​ogle表格中自动重新计算自定义函数?我知道人们已经尝试添加now()作为参数,不管是否需要,它都会不断重新计算. (现在在新表格中被封锁.)有没有人找到满意的解决方案?

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

Custom function arguments must be 07001. 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.

MogsdadMogsdad到这个答案:

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

点赞