ContentService

Service for returning text content from a script.

You can serve up text in various forms. For example, publish this script as a web app.

```javascript
function doGet() {
  return ContentService.createTextOutput('Hello World');
}
```
When visiting the web app URL you will see "Hello World" in the browser. Due to security considerations, scripts cannot directly return content to a browser. Instead, they must serve the content from a different URL. This is why the URL in the browser for output created via this web app will be different than the original script URL.

### Properties

| Property | Type | Description |
|---|---|---|
| `MimeType` | `https://developers.google.com/apps-script/reference/content/mime-type` |   |

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/content/content-service#createTextOutput()` | `https://developers.google.com/apps-script/reference/content/text-output` | Create a new `https://developers.google.com/apps-script/reference/content/text-output` object. |
| `https://developers.google.com/apps-script/reference/content/content-service#createTextOutput(String)` | `https://developers.google.com/apps-script/reference/content/text-output` | Create a new `https://developers.google.com/apps-script/reference/content/text-output` object that can serve the given content. |

## Detailed documentation

### `createTextOutput()`

Create a new `https://developers.google.com/apps-script/reference/content/text-output` object.

```javascript
function doGet() {
  const output = ContentService.createTextOutput();
  output.append('Hello world!');
  return output;
}
```

#### Return


`https://developers.google.com/apps-script/reference/content/text-output` --- the new TextOutput object.

*** ** * ** ***

### `createTextOutput(content)`

Create a new `https://developers.google.com/apps-script/reference/content/text-output` object that can serve the given content.

```javascript
function doGet() {
  const output = ContentService.createTextOutput('Hello world!');
  return output;
}
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `content` | `String` | the content to serve. |

#### Return


`https://developers.google.com/apps-script/reference/content/text-output` --- the new TextOutput object.