Class PropertiesService
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
속성서비스
스크립트가 하나의 스크립트, 스크립트의 한 사용자 또는 부가기능이 사용되는 하나의 문서로 범위가 지정된 키-값 쌍에 간단한 데이터를 저장할 수 있습니다. 스크립트 간에 속성을 공유할 수 없습니다.
각 유형의 속성을 사용해야 하는 경우에 대한 자세한 내용은 속성 서비스 가이드를 참고하세요.
// Sets three properties of different types.
const documentProperties = PropertiesService.getDocumentProperties();
const scriptProperties = PropertiesService.getScriptProperties();
const userProperties = PropertiesService.getUserProperties();
documentProperties.setProperty('DAYS_TO_FETCH', '5');
scriptProperties.setProperty(
'SERVER_URL',
'http://www.example.com/MyWeatherService/',
);
userProperties.setProperty('DISPLAY_UNITS', 'metric');
자세한 문서
getDocumentProperties()
모든 사용자가 열려 있는 문서, 스프레드시트 또는 양식 내에서 액세스할 수 있는 속성 저장소 (이 스크립트만 해당)를 가져옵니다. 스크립트가 부가기능으로 게시되고 실행 중이거나 Google 파일 유형에 바인딩된 경우에만 사용할 수 있습니다. 문서 속성을 사용할 수 없는 경우 이 메서드는 null
를 반환합니다. 스크립트에서 만든 문서 속성은 동일한 문서에 액세스하는 다른 스크립트도 해당 스크립트 외부에서 액세스할 수 없습니다.
리턴
Properties
: 현재 문서의 모든 사용자가 액세스할 수 있는 이 스크립트의 속성 저장소 또는 스크립트가 부가기능이 아니거나 Google Workspace 파일에 바인딩되지 않은 경우 null
getScriptProperties()
모든 사용자가 이 스크립트 내에서만 액세스할 수 있는 속성 스토어를 가져옵니다.
리턴
Properties
: 스크립트의 모든 사용자가 액세스할 수 있는 속성 저장소입니다.
getUserProperties()
현재 사용자만 이 스크립트 내에서 액세스할 수 있는 속성 스토어를 가져옵니다.
리턴
Properties
: 스크립트의 현재 사용자만 액세스할 수 있는 속성 저장소입니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003eThe Properties Service lets Apps Script store simple data as key-value pairs, with different scopes for scripts, users, and documents.\u003c/p\u003e\n"],["\u003cp\u003eIt offers three methods to access properties: \u003ccode\u003egetDocumentProperties()\u003c/code\u003e, \u003ccode\u003egetScriptProperties()\u003c/code\u003e, and \u003ccode\u003egetUserProperties()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetDocumentProperties()\u003c/code\u003e provides property storage accessible to all users within a specific document, spreadsheet, or form where the script is running.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetScriptProperties()\u003c/code\u003e allows storing properties accessible to all users, but only within the context of the current script.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetUserProperties()\u003c/code\u003e provides a property store specific to the current user and accessible only within the current script.\u003c/p\u003e\n"]]],["The `PropertiesService` stores data in key-value pairs, accessible via `getDocumentProperties`, `getScriptProperties`, and `getUserProperties`. `getDocumentProperties` stores data within a specific document, accessible to all users. `getScriptProperties` stores data within a script, accessible to all users. `getUserProperties` stores data for a single user within a script. The example code demonstrates setting properties using each method: `setProperty`. Each method returns a `Properties` object, which is a property store.\n"],null,["# Class PropertiesService\n\nPropertiesService\n\nAllows scripts to store simple data in key-value pairs scoped to one script, one user of a\nscript, or one document in which an add-on is used. Properties cannot be shared between scripts.\nFor more information about when to use each type of property, see the [guide to the Properties service](/apps-script/guides/properties).\n\n```javascript\n// Sets three properties of different types.\nconst documentProperties = PropertiesService.getDocumentProperties();\nconst scriptProperties = PropertiesService.getScriptProperties();\nconst userProperties = PropertiesService.getUserProperties();\n\ndocumentProperties.setProperty('DAYS_TO_FETCH', '5');\nscriptProperties.setProperty(\n 'SERVER_URL',\n 'http://www.example.com/MyWeatherService/',\n);\nuserProperties.setProperty('DISPLAY_UNITS', 'metric');\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------------------------------|------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|\n| [getDocumentProperties()](#getDocumentProperties()) | [Properties](/apps-script/reference/properties/properties) | Gets a property store (for this script only) that all users can access within the open document, spreadsheet, or form. |\n| [getScriptProperties()](#getScriptProperties()) | [Properties](/apps-script/reference/properties/properties) | Gets a property store that all users can access, but only within this script. |\n| [getUserProperties()](#getUserProperties()) | [Properties](/apps-script/reference/properties/properties) | Gets a property store that only the current user can access, and only within this script. |\n\nDetailed documentation\n----------------------\n\n### `get``Document``Properties()`\n\nGets a property store (for this script only) that all users can access within the open\ndocument, spreadsheet, or form. It is only available if the script is published and executing\nas an add-on or if it is [bound](https://developers.google.com/apps-script/scripts_containers) to a Google file\ntype. When document properties are not available this method returns `null`. Document\nproperties created by a script are not accessible outside that script, even by other scripts\naccessing the same document.\n\n#### Return\n\n\n[Properties](/apps-script/reference/properties/properties) --- a property store for this script only that all users of the current document can\naccess, or `null` if the script is not either an add-on or bound to a Google\nWorkspace file\n\n*** ** * ** ***\n\n### `get``Script``Properties()`\n\nGets a property store that all users can access, but only within this script.\n\n#### Return\n\n\n[Properties](/apps-script/reference/properties/properties) --- a property store that all users of the script can access\n\n*** ** * ** ***\n\n### `get``User``Properties()`\n\nGets a property store that only the current user can access, and only within this script.\n\n#### Return\n\n\n[Properties](/apps-script/reference/properties/properties) --- a property store that only the current user of the script can access"]]