0

I have a Google spreadsheet that has it's data loaded using a custom function. The custom function calls a REST API, transforms the data and displays it.

The problem is that every time I open the doc, the function is called and all the REST API calls go out.

I need to be able to manually trigger service calls to refresh data, and in between show the data from last time.

How can I best achieve that?

4

1 回答 1

3

简短的回答

而不是从公式(自定义函数)调用您的函数,而是从以下位置调用它:

  • 脚本编辑器
  • 自定义菜单

解释

此时,当电子表格打开并且其任何参数更改其值时,将重新计算自定义函数。要随意运行该功能,请使用脚本编辑器播放或调试按钮或自定义菜单。您也可以使用其他触发器。选择最适合您需求的一种。

如果您仍想缓存调用相应 REST API 的结果,请使用Class Cache

参考

于 2016-10-14T12:12:51.750 回答