I'm trying to figure out if Google App Script language supports any sort of matrix operations that can be used on the back end.
Thanks!
I'm trying to figure out if Google App Script language supports any sort of matrix operations that can be used on the back end.
Thanks!
Google Apps Script is a variant of Javascript - so, yes, it can support matrix operations, or any other math you want to do. Also like Javascript, it cannot do so natively - you need to write the functions yourself, or find a library that suits.
For matrix operations in particular, here's an option. Jos de Jong's mathjs library for Node.js works as-is in Google Apps Script. You can read up on its support for matrices here.
Copy the minimized
math.js
source from github, and paste it into a new script file in the script that you want to add the library to. With that done, the library is accessible asmath
, e.g.math.someMethod()
Try the following example - the comments show what you can expect in the logs: