Content Service

Content

This service allows scripts to serve text in various forms, such as text, XML, or JSON. See also the guide to Content Service . If you deploy the following script as a web app , you will see "Hello, world!" in the browser:

 function doGet() {
  return ContentService.createTextOutput('Hello, world!');
} 

Classes

Name Brief description
Content Service Service for returning text content from a script.
Mime Type An enum for mime types that can be served from a script.
Text Output A TextOutput object that can be served from a script.

Content Service

Properties

Property Type Description
Mime Type
Mime Type

Methods

Method Return type Brief description
Text Output Create a new Text Output object.
Text Output Create a new Text Output object that can serve the given content.

Mime Type

Properties

Property Type Description
CSV
Enum CSV Mime Type
ICAL
Enum ICAL Mime Type
JAVASCRIPT
Enum JAVASCRIPT Mime Type
JSON
Enum JSON Mime Type
TEXT
Enum TEXT Mime Type
VCARD
Enum VCARD Mime Type

Text Output

Methods

Method Return type Brief description
Text Output Appends new content to the content that will be served.
Text Output Clears the current content.
Text Output Tells browsers to download rather than display this content.
String Gets the content that will be served.
String Returns the file name to download this file as, or null if it should be displayed rather than downloaded.
Mime Type Get the mime type this content will be served with.
Text Output Sets the content that will be served.
Text Output Sets the mime type for content that will be served.
Create a Mobile Website
View Site in Mobile | Classic
Share by: