class HtmlService method .setSandboxMode()

HtmlService is the Apps Script service.

.setSandboxMode() is the method name you will see after a dot in your code.

What it does

Sets how much access client-side JavaScript has in the output.

Why it's used

  • Control how much client-side JS can reach server functions.
  • Tighten security on public web app HTML.

Common errors

  • Forgetting parentheses on setSandboxMode. Write HtmlService.setSandboxMode(), not HtmlService.setSandboxMode or setSandboxMode by itself.
  • Skipping dots between chained calls. Each step needs a dot, like HtmlService.setSandboxMode().
  • Adding spaces where they do not belong. Write HtmlService.setSandboxMode(), not HtmlService .setSandboxMode(), HtmlService.setSandboxMode (), or HtmlService . setSandboxMode().
  • Wrong capitalization. Use HtmlService and setSandboxMode, not htmlservice or setsandboxmode.

Explore

Related methods

Better Sheets tutorials

No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.

Related blog posts

Written guides about HtmlService.setSandboxMode().

Browse the blog