HTML

This service allows Apps Script applications to return HTML, usually as a user interface.
If you're new to using this class, we recommend you also see the
[guide to Html Service](https://developers.google.com/apps-script/html_service)
.

## Classes

| Name | Brief description |
|---|---|
| `https://developers.google.com/apps-script/reference/html/html-output` | An `HtmlOutput` object that can be served from a script. |
| `https://developers.google.com/apps-script/reference/html/html-output-meta-tag` | An object that represents a meta tag added to the page by calling `https://developers.google.com/apps-script/reference/html/html-output#addMetaTag(String,String)`. |
| `https://developers.google.com/apps-script/reference/html/html-service` | Service for returning HTML and other text content from a script. |
| `https://developers.google.com/apps-script/reference/html/html-template` | A template object for dynamically constructing HTML. |
| `https://developers.google.com/apps-script/reference/html/sandbox-mode` | An enum representing the sandbox modes that can be used for client-side `https://developers.google.com/apps-script/reference/html/html-service` scripts. |
| `https://developers.google.com/apps-script/reference/html/x-frame-options-mode` | An enum representing the `X-Frame-Options` modes that can be used for client-side `https://developers.google.com/apps-script/reference/html/html-service` scripts. |

## `https://developers.google.com/apps-script/reference/html/html-output`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/html/html-output#addMetaTag(String,String)` | `https://developers.google.com/apps-script/reference/html/html-output` | Adds a meta tag to the page. |
| `https://developers.google.com/apps-script/reference/html/html-output#append(String)` | `https://developers.google.com/apps-script/reference/html/html-output` | Appends new content to the content of this `HtmlOutput`. |
| `https://developers.google.com/apps-script/reference/html/html-output#appendUntrusted(String)` | `https://developers.google.com/apps-script/reference/html/html-output` | Appends new content to the content of this `HtmlOutput`, using contextual escaping. |
| `https://developers.google.com/apps-script/reference/html/html-output#asTemplate()` | `https://developers.google.com/apps-script/reference/html/html-template` | Returns an `https://developers.google.com/apps-script/reference/html/html-template` backed by this `HtmlOutput`. |
| `https://developers.google.com/apps-script/reference/html/html-output#clear()` | `https://developers.google.com/apps-script/reference/html/html-output` | Clears the current content. |
| `https://developers.google.com/apps-script/reference/html/html-output#getAs(String)` | `https://developers.google.com/apps-script/base/blob.html` | Return the data inside this object as a blob converted to the specified content type. |
| `https://developers.google.com/apps-script/reference/html/html-output#getBlob()` | `https://developers.google.com/apps-script/base/blob.html` | Return the data inside this object as a blob. |
| `https://developers.google.com/apps-script/reference/html/html-output#getContent()` | `String` | Gets the content of this `HtmlOutput`. |
| `https://developers.google.com/apps-script/reference/html/html-output#getFaviconUrl()` | `String` | Gets the URL for a favicon link tag added to the page by calling `https://developers.google.com/apps-script/reference/html/html-output#setFaviconUrl(String)`. |
| `https://developers.google.com/apps-script/reference/html/html-output#getHeight()` | `Integer` | Gets the initial height of the [custom dialog](https://developers.google.com/apps-script/guides/dialogs) in Google Docs, Sheets, or Forms. |
| `https://developers.google.com/apps-script/reference/html/html-output#getMetaTags()` | `https://developers.google.com/apps-script/reference/html/html-output-meta-tag` | Gets an array of objects that represent meta tags added to the page by calling `https://developers.google.com/apps-script/reference/html/html-output#addMetaTag(String,String)`. |
| `https://developers.google.com/apps-script/reference/html/html-output#getTitle()` | `String` | Gets the title of the output page. |
| `https://developers.google.com/apps-script/reference/html/html-output#getWidth()` | `Integer` | Gets the initial width of the [custom dialog](https://developers.google.com/apps-script/guides/dialogs) in Google Docs, Sheets, or Forms. |
| `https://developers.google.com/apps-script/reference/html/html-output#setContent(String)` | `https://developers.google.com/apps-script/reference/html/html-output` | Sets the content of this `HtmlOutput`. |
| `https://developers.google.com/apps-script/reference/html/html-output#setFaviconUrl(String)` | `https://developers.google.com/apps-script/reference/html/html-output` | Adds a link tag for a favicon to the page. |
| `https://developers.google.com/apps-script/reference/html/html-output#setHeight(Integer)` | `https://developers.google.com/apps-script/reference/html/html-output` | Sets the initial height of the [custom dialog](https://developers.google.com/apps-script/guides/dialogs) in Google Docs, Sheets, or Forms. |
| `https://developers.google.com/apps-script/reference/html/html-output#setSandboxMode(SandboxMode)` | `https://developers.google.com/apps-script/reference/html/html-output` | This method now has no effect --- previously it set the `https://developers.google.com/apps-script/reference/html/sandbox-mode` used for client-side scripts. |
| `https://developers.google.com/apps-script/reference/html/html-output#setTitle(String)` | `https://developers.google.com/apps-script/reference/html/html-output` | Sets the title of the output page. |
| `https://developers.google.com/apps-script/reference/html/html-output#setWidth(Integer)` | `https://developers.google.com/apps-script/reference/html/html-output` | Sets the initial width of a [custom dialog](https://developers.google.com/apps-script/guides/dialogs) in Google Docs, Sheets, or Forms. |
| `https://developers.google.com/apps-script/reference/html/html-output#setXFrameOptionsMode(XFrameOptionsMode)` | `https://developers.google.com/apps-script/reference/html/html-output` | Sets the state of the page's `X-Frame-Options` header, which controls clickjacking prevention. |

## `https://developers.google.com/apps-script/reference/html/html-output-meta-tag`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/html/html-output-meta-tag#getContent()` | `String` | Gets the content of this meta tag. |
| `https://developers.google.com/apps-script/reference/html/html-output-meta-tag#getName()` | `String` | Gets the name of this `HtmlOutputMetaTag`. |

## `https://developers.google.com/apps-script/reference/html/html-service`

### Properties

| Property | Type | Description |
|---|---|---|
| `SandboxMode` | `https://developers.google.com/apps-script/reference/html/sandbox-mode` | An enum representing the sandbox modes that can be used for client-side `HtmlService` scripts. |
| `XFrameOptionsMode` | `https://developers.google.com/apps-script/reference/html/x-frame-options-mode` | An enum representing the `X-Frame-Options` modes that can be used for client-side `HtmlService` scripts. |

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/html/html-service#createHtmlOutput()` | `https://developers.google.com/apps-script/reference/html/html-output` | Creates a new `https://developers.google.com/apps-script/reference/html/html-output` object that can be returned from the script. |
| `https://developers.google.com/apps-script/reference/html/html-service#createHtmlOutput(BlobSource)` | `https://developers.google.com/apps-script/reference/html/html-output` | Creates a new `https://developers.google.com/apps-script/reference/html/html-output` object from a `https://developers.google.com/apps-script/base/blob-source.html` resource. |
| `https://developers.google.com/apps-script/reference/html/html-service#createHtmlOutput(String)` | `https://developers.google.com/apps-script/reference/html/html-output` | Creates a new `https://developers.google.com/apps-script/reference/html/html-output` object that can be returned from the script. |
| `https://developers.google.com/apps-script/reference/html/html-service#createHtmlOutputFromFile(String)` | `https://developers.google.com/apps-script/reference/html/html-output` | Creates a new `https://developers.google.com/apps-script/reference/html/html-output` object from a file in the code editor. |
| `https://developers.google.com/apps-script/reference/html/html-service#createTemplate(BlobSource)` | `https://developers.google.com/apps-script/reference/html/html-template` | Creates a new `https://developers.google.com/apps-script/reference/html/html-template` object from a `https://developers.google.com/apps-script/base/blob-source.html` resource. |
| `https://developers.google.com/apps-script/reference/html/html-service#createTemplate(String)` | `https://developers.google.com/apps-script/reference/html/html-template` | Creates a new `https://developers.google.com/apps-script/reference/html/html-template` object that can be returned from the script. |
| `https://developers.google.com/apps-script/reference/html/html-service#createTemplateFromFile(String)` | `https://developers.google.com/apps-script/reference/html/html-template` | Creates a new `https://developers.google.com/apps-script/reference/html/html-template` object from a file in the code editor. |
| `https://developers.google.com/apps-script/reference/html/html-service#getUserAgent()` | `String` | Gets the user-agent string for the current browser. |

## `https://developers.google.com/apps-script/reference/html/html-template`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/html/html-template#evaluate()` | `https://developers.google.com/apps-script/reference/html/html-output` | Evaluates this template and returns an `https://developers.google.com/apps-script/reference/html/html-output` object. |
| `https://developers.google.com/apps-script/reference/html/html-template#getCode()` | `String` | Generates a string of JavaScript code, based on the template file, that can be evaluated. |
| `https://developers.google.com/apps-script/reference/html/html-template#getCodeWithComments()` | `String` | Generates a string of JavaScript code that can be evaluated, with each line of the code containing the original line from the template as a comment. |
| `https://developers.google.com/apps-script/reference/html/html-template#getRawContent()` | `String` | Returns the unprocessed content of this template. |

## `https://developers.google.com/apps-script/reference/html/sandbox-mode`

### Properties

| Property | Type | Description |
|---|---|---|
| `EMULATED` | `Enum` | A legacy sandbox mode that emulates ECMAScript 5 strict mode using only the features available in ECMAScript 3. |
| `IFRAME` | `Enum` | A sandbox mode that uses iframe sandboxing instead of the Caja sandbox technology used by the `EMULATED` and `NATIVE` modes. |
| `NATIVE` | `Enum` | A sandbox mode that is built on top of ECMAScript 5 strict mode. |

## `https://developers.google.com/apps-script/reference/html/x-frame-options-mode`

### Properties

| Property | Type | Description |
|---|---|---|
| `ALLOWALL` | `Enum` | No `X-Frame-Options` header is set. |
| `DEFAULT` | `Enum` | Sets the default value for the `X-Frame-Options` header, which preserves normal security assumptions. |