Content Service

  • The Content Service allows scripts to serve text in various formats like text, XML, or JSON.

  • The ContentService class is used for returning text content from a script.

  • The MimeType enum defines the various mime types that can be served from a script.

  • The TextOutput object represents the text content that can be served from a script.

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

ContentService

Properties

PropertyTypeDescription
MimeTypeMimeType

Methods

MethodReturn typeBrief description
createTextOutput()TextOutputCreate a new TextOutput object.
createTextOutput(content)TextOutputCreate a new TextOutput object that can serve the given content.

MimeType

Properties

PropertyTypeDescription
CSVEnumCSV Mime Type
ICALEnumICAL Mime Type
JAVASCRIPTEnumJAVASCRIPT Mime Type
JSONEnumJSON Mime Type
TEXTEnumTEXT Mime Type
VCARDEnumVCARD Mime Type

TextOutput

Methods