AI-generated Key Takeaways
-
ContentService allows you to serve text content from a script, for example, by publishing the script as a web app.
-
When serving content through a web app, the browser URL will differ from the original script URL for security reasons.
-
The
createTextOutput()method is used to create aTextOutputobject which can serve text content. -
The
createTextOutput(content)method allows you to create aTextOutputobject with initial content.
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.
function doGet() { return ContentService.createTextOutput('Hello World'); }
Properties
| Property | Type | Description |
|---|---|---|
Mime | Mime |
Methods
| Method | Return type | Brief description |
|---|---|---|
create | Text | Create a new Text object. |
create | Text | Create a new Text object that can serve the given content. |
Detailed documentation
createTextOutput()
Create a new Text object.
function doGet() { const output = ContentService.createTextOutput(); output.append('Hello world!'); return output; }
Return
Text — the new TextOutput object.
createTextOutput(content)
Create a new Text object that can serve the given content.
function doGet() { const output = ContentService.createTextOutput('Hello world!'); return output; }
Parameters
| Name | Type | Description |
|---|---|---|
content | String | the content to serve. |
Return
Text — the new TextOutput object.