Content Service
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
콘텐츠
이 서비스를 사용하면 스크립트가 텍스트, XML, JSON과 같은 다양한 형식으로 텍스트를 제공할 수 있습니다. 콘텐츠 서비스 가이드도 참고하세요. 다음 스크립트를 웹 앱으로 배포하면 브라우저에 'Hello, world!'가 표시됩니다.
function doGet() {
return ContentService.createTextOutput('Hello, world!');
}
클래스
속성
속성 | 유형 | 설명 |
CSV | Enum | CSV MIME 유형 |
ICAL | Enum | ICAL MIME 유형 |
JAVASCRIPT | Enum | JAVASCRIPT MIME 유형 |
JSON | Enum | JSON MIME 유형 |
TEXT | Enum | TEXT MIME 유형 |
VCARD | Enum | VCARD MIME 유형 |
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003eThe Content Service enables scripts to serve content like text, XML, or JSON, offering flexibility in data delivery.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can utilize the ContentService class to generate and manipulate text output within their scripts.\u003c/p\u003e\n"],["\u003cp\u003eMimeType aids in specifying the desired format for content delivery, accommodating various data types like CSV, JSON, and more.\u003c/p\u003e\n"],["\u003cp\u003eThe TextOutput class provides methods for managing the content, allowing for appending, clearing, and setting the output's format.\u003c/p\u003e\n"],["\u003cp\u003eContent served through scripts can be customized for display in browsers or downloaded as files, offering versatile content handling.\u003c/p\u003e\n"]]],[],null,["# Content Service\n\nContent\n\nThis service allows scripts to serve text in various forms, such as text,\nXML, or JSON. See also the [guide to\nContent Service](/apps-script/content_service). If you\n[deploy the following script as a web app](/apps-script/execution_web_apps),\nyou will see \"Hello, world!\" in the browser: \n\n function doGet() {\n return ContentService.createTextOutput('Hello, world!');\n }\n\nClasses\n-------\n\n| Name | Brief description |\n|------------------------------------------------------------------|----------------------------------------------------------|\n| [ContentService](/apps-script/reference/content/content-service) | Service for returning text content from a script. |\n| [MimeType](/apps-script/reference/content/mime-type) | An enum for mime types that can be served from a script. |\n| [TextOutput](/apps-script/reference/content/text-output) | A TextOutput object that can be served from a script. |\n\n[ContentService](/apps-script/reference/content/content-service)\n----------------------------------------------------------------\n\n### Properties\n\n| Property | Type | Description |\n|--------------|------------------------------------------------------|-------------|\n| `Mime``Type` | [MimeType](/apps-script/reference/content/mime-type) | |\n\n### Methods\n\n| Method | Return type | Brief description |\n|------------------------------------------------------------------------------------------------------|----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|\n| [createTextOutput()](/apps-script/reference/content/content-service#createTextOutput()) | [TextOutput](/apps-script/reference/content/text-output) | Create a new [TextOutput](/apps-script/reference/content/text-output) object. |\n| [createTextOutput(content)](/apps-script/reference/content/content-service#createTextOutput(String)) | [TextOutput](/apps-script/reference/content/text-output) | Create a new [TextOutput](/apps-script/reference/content/text-output) object that can serve the given content. |\n\n[MimeType](/apps-script/reference/content/mime-type)\n----------------------------------------------------\n\n### Properties\n\n| Property | Type | Description |\n|--------------|--------|----------------------|\n| `CSV` | `Enum` | CSV Mime Type |\n| `ICAL` | `Enum` | ICAL Mime Type |\n| `JAVASCRIPT` | `Enum` | JAVASCRIPT Mime Type |\n| `JSON` | `Enum` | JSON Mime Type |\n| `TEXT` | `Enum` | TEXT Mime Type |\n| `VCARD` | `Enum` | VCARD Mime Type |\n\n[TextOutput](/apps-script/reference/content/text-output)\n--------------------------------------------------------\n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------------------------------------------------------------------------|----------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|\n| [append(addedContent)](/apps-script/reference/content/text-output#append(String)) | [TextOutput](/apps-script/reference/content/text-output) | Appends new content to the content that will be served. |\n| [clear()](/apps-script/reference/content/text-output#clear()) | [TextOutput](/apps-script/reference/content/text-output) | Clears the current content. |\n| [downloadAsFile(filename)](/apps-script/reference/content/text-output#downloadAsFile(String)) | [TextOutput](/apps-script/reference/content/text-output) | Tells browsers to download rather than display this content. |\n| [getContent()](/apps-script/reference/content/text-output#getContent()) | `String` | Gets the content that will be served. |\n| [getFileName()](/apps-script/reference/content/text-output#getFileName()) | `String` | Returns the file name to download this file as, or null if it should be displayed rather than downloaded. |\n| [getMimeType()](/apps-script/reference/content/text-output#getMimeType()) | [MimeType](/apps-script/reference/content/mime-type) | Get the mime type this content will be served with. |\n| [setContent(content)](/apps-script/reference/content/text-output#setContent(String)) | [TextOutput](/apps-script/reference/content/text-output) | Sets the content that will be served. |\n| [setMimeType(mimeType)](/apps-script/reference/content/text-output#setMimeType(MimeType)) | [TextOutput](/apps-script/reference/content/text-output) | Sets the mime type for content that will be served. |"]]