GSheets / JS: Convert Sheets Custom Function to Accept 2D Array as Parameter | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

GSheets / JS: Convert Sheets Custom Function to Accept 2D Array as Parameter

Hi everyone, I have a custom script in Google Sheets i copypasta'd from Stack Exchange a long time ago and today have found google is preventing the custom function running because my account has hit some sort of execution limit. The Google Dev site https://developers.google.com/apps-script/guides/sheets/functions#optimization says to make custom functions accept arrays of data that can then be overflowed out over cells when the values are returned to help lower the amount of executions needed. Custom functions are written in JS. The custom function is: function doMath( formula ) { // Strip leading "=" if there if (formula.charAt(0) === '=') formula = formula.substring(1); return eval(formula) } and an example of formula is: "15 / 0.3 + 1" I know you might think its odd to do a simple math expression with a custom function, but the reason is because it's pulling values from different places in the Sheet and converting from a text formula like: Length / 0.3 + 1 and was the only (or quickest?) way I could set this up a few years back.

9th Sep 2022, 12:09 AM
Nathan Stanley
Nathan Stanley - avatar
1 Answer
+ 1
so , what's your question? are you unable to setup things ?
9th Sep 2022, 3:32 AM
Prashanth Kumar
Prashanth Kumar - avatar