Google Apps Script Javascript Standard Support
Google Apps Script Javascript Standard Support
Simple question: Can anyone point to a resource or knows anything about which standard of Javascript is supported in Google Apps Script?
I assume naturally that ES5 is fully supported, but what about ES6 (and even 7)?
Note: I mean the built-in code editor, which will appear if you open a Spreadsheet (for example), and click Tools > Script editor...
Tools > Script editor...
Thanks @SandyGood - I'll transfer the question.
– Selfish
Jun 11 '16 at 21:44
Possible duplicate of Which Edition of ECMA-262 Does Google Apps Script Support?
– Rubén
Jun 12 '16 at 1:11
const
is valid in Apps Script btw, but let
is (currently) not– tehhowch
Aug 16 '18 at 14:09
const
let
3 Answers
3
According to the docs Apps Script is based on JavaScript 1.6.
This table explains the correlation to the ES standards.
Thanks! Oddly searches didn't lead to this page. Just what I was looking for. :)
– Selfish
Jun 13 '16 at 7:38
Playing with Google Sheets custom functions right now It doesn't like
let
but it does like var
. Apparently const
is ok. But 1.6 has let, const, etc. Oh,well.– Paul
Apr 23 '18 at 4:32
let
var
const
@Paul thanks for the update. A lot has changed since summer '16. :)
– Selfish
Aug 20 '18 at 11:15
The Mozilla page says 1.6 corresponds to "ECMA-262 Edition 3". So that is earlier than ES5?
– Dustin Michels
Nov 14 '18 at 19:05
In the native editor it appears you are limited to an earlier version of JS (~ES5).
There is an official tool called "Clasp" though, which lets you write typescript (.ts
) files with ES6+ syntax and then compile & upload your files to Drive with clasp push --watch
.
.ts
clasp push --watch
Alternatively, you can use Webpack in your local setup as detailed in this answer.
My guess is AngluarJS is since it was made by a google developer.
I didn't quite get that. AngularJS is not a standard of JS, and isn't used in Apps Script. I wasn't asking which framework was Google Drive implemented in, if this is what you intended.
– Selfish
Jun 11 '16 at 21:09
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Anyone who would know the answer is more likely to see your question and answer it at the Apps Script Group - LINK I don't know of any official documentation for this. Issues related to this have been discussed in the Apps Script group, for example: let and const are part of es6 specification, and have not been implemented in the Apps Script js engine. (As far as I know, at this moment in time) Whether Apps Script server side code supports something is probably just trial and error.
– Sandy Good
Jun 11 '16 at 21:43