GeoffreyS
GeoffreyS

Reputation: 125

Standard Javascript in Google Apps Script

Is it possible to put normal Javascript in a Google Apps Script file? I know it follows JS syntax but can I use the output of a JS function in a Google function? I'm new to this and I don't know the limitations.

Upvotes: 0

Views: 802

Answers (1)

Alan Wells
Alan Wells

Reputation: 31300

In HTML served by Apps Script you can use DOM interfaces like the Document object and the getElementById() method of the Document object. getElementById You can also use jQuery. See --> Best Practices

Apps Script uses JavaScript as it's server side language. You can't use the DOM or jQuery in server side code.

With the new html iframe mode, you can use angularJs in HTML (client side).

There are JavaScript restrictions in the HTML Service: https://developers.google.com/apps-script/guides/html/restrictions#javascript

For server side code, most any JavaScript method/property can be used. For dates in server side .gs scripts, you can use the Apps Script formatDate() method of the Utilities Service.

Use the Cache Service for storing data to pass between functions in server side JavaScript, rather than looking up the same data multiple times.

Upvotes: 1

Related Questions