Many math functions are not available in Google Sheets Apps Script. To use JavaScript functions, is there any complete guide available

Viewed 37

Functions such as Math.pow(base,raiseto) are not in Google Sheets Apps Script. Any suggestions excepting writing our own code lines? Tried several variations: Math.POW(a,b), Math.power(), a^b, pow(a,b), etc.

Finally managed with a for loop;

S=Ra;
for (var counter=1; counter <= N; counter=counter+1){
S=S*Ra;    
}
1 Answers

I am not sure how you are using the Math.pow, I have tested it and it works. enter image description here

Also Google Apps Script is essentially based on JavaScript you can expect that most if not all JavaScript functions work on Apps Script.

As for the Math specifically, if you try just typing "Math." the Google Apps Script Editor will show hints on which functions are available to use. In my experience, there may be some functions that may not be shown in the IntelliSense but still works when you try as long as they are in correct JavaScript syntax.enter image description here

Related