Builds a text response for a web app request.
class ContentService method .createTextOutput()
ContentService is the Apps Script service.
.createTextOutput() is the method name you will see after a dot in your code.
What it does
Why it's used
- Return plain text or JSON from a web app doGet.
- Send a simple API response from Apps Script.
Common errors
- Forgetting parentheses on createTextOutput. Write ContentService.createTextOutput(), not ContentService.createTextOutput or createTextOutput by itself.
- Skipping dots between chained calls. Each step needs a dot, like ContentService.createTextOutput().
- Adding spaces where they do not belong. Write ContentService.createTextOutput(), not ContentService .createTextOutput(), ContentService.createTextOutput (), or ContentService . createTextOutput().
- Wrong capitalization. Use ContentService and createTextOutput, not contentservice or createtextoutput.
2 Snippets using this methods
Explore
Related methods
-
.setMimeType()
Sets the content type of a web app response, like JSON or XML.
More Apps Script
2 Better Sheets tutorials