I want to use Google Apps Script to make custom functions for a spreadsheet. I've made an extremely simple function:
function foo(){
return "bar";
};
The problem is that I need this function in a couple hundred cells. When I paste the function =foo()
into all of these cells, the function works in a few of the cells, but in most I get this error: "Service invoked too many times: spreadsheet. Try Utilities.sleep(1000)
between calls."
I guess I don't understand why this function, simple as it is, is considered an invocation of the Spreadsheet Services. I'm not even requesting any data (except for the function itself). Is that the problem? And if so, is there a workaround? Custom functions could make Google Spreadsheets infinitely more powerful, but this problem hamstrings the possibility of using a custom function in multiple cells. Suggestions?
(P.S. -- Using the Utilities.sleep()
function as suggested by the error message doesn't help at all when all of the cells call their functions simultaneously; it only slows the rate at which individual cells repeatedly call the function.)