Use standard table functions in scripts?
When I write a script and want to use a standard function like. WEEKNUM
, is this possible directly or do I need to call the Formula on another field through setFormula(formula)
and then read the content from the linked cell?
The approach you describe is indeed possible, but not efficient at all because it needs multiple calls to read / write spreadsheets, which are relatively slow ...
Using native spreadsheet functions in JavaScript (Google-Apps-Script) is otherwise not possible .
Try to find the equivalent in JavaScript.
If you don't know how to get some result in JS, a google search will give the answer in most cases.
For your WEEKNUM example, a search will return this result like