Properties Service
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
خواص
این سرویس به اسکریپتها اجازه میدهد تا رشتهها را بهعنوان جفتهای کلید-مقدار در محدوده یک اسکریپت، یک کاربر از یک اسکریپت، یا یک سند که در آن افزونه ویرایشگر استفاده میشود، ذخیره کنند. برای اطلاعات بیشتر در مورد زمان استفاده از هر نوع دارایی، به راهنمای سرویس Properties مراجعه کنید.
کلاس ها
نام | شرح مختصر |
---|
Properties | شی خواص به عنوان رابط برای دسترسی به ویژگی های کاربر، سند یا اسکریپت عمل می کند. |
Properties Service | به اسکریپتها اجازه میدهد دادههای ساده را در جفتهای کلید-مقدار با محدوده یک اسکریپت، یک کاربر یک اسکریپت، یا یک سند که در آن یک افزونه استفاده میشود، ذخیره کنند. |
Script Properties
| ویژگی های اسکریپت جفت های کلید-مقدار هستند که توسط یک اسکریپت در یک فروشگاه دائمی ذخیره می شوند. |
User Properties
| ویژگی های کاربر جفت های کلید-مقدار منحصر به فرد یک کاربر هستند. |
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe Properties Service allows scripts to store data as key-value pairs, with different scopes available: script, user, or document.\u003c/p\u003e\n"],["\u003cp\u003eThis service offers classes for managing properties like Properties, PropertiesService, ScriptProperties, and UserProperties, each with its own specific purpose.\u003c/p\u003e\n"],["\u003cp\u003eProperties can be manipulated with methods such as deleting, retrieving by key or in bulk, and setting new values.\u003c/p\u003e\n"],["\u003cp\u003eDifferent property stores can be accessed, including document-specific, script-wide, or user-specific stores, through the PropertiesService class.\u003c/p\u003e\n"]]],[],null,["# Properties Service\n\nProperties\n\nThis service allows scripts to store strings as key-value pairs scoped to\none script, one user of a script, or one document in which an\n[editor add-on](/gsuite/add-ons/concepts/types#editor_add-ons) is used.\nFor more information about when to use each type of property, see the\n[guide to the Properties service](/apps-script/guides/properties).\n\nClasses\n-------\n\n| Name | Brief description |\n|---------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Properties](/apps-script/reference/properties/properties) | The properties object acts as the interface to access user, document, or script properties. |\n| [PropertiesService](/apps-script/reference/properties/properties-service) | Allows scripts to store simple data in key-value pairs scoped to one script, one user of a script, or one document in which an add-on is used. |\n| [ScriptProperties](/apps-script/reference/properties/script-properties) | Script Properties are key-value pairs stored by a script in a persistent store. |\n| [UserProperties](/apps-script/reference/properties/user-properties) | User Properties are key-value pairs unique to a user. |\n\n[Properties](/apps-script/reference/properties/properties)\n----------------------------------------------------------\n\n### Methods\n\n| Method | Return type | Brief description |\n|--------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|\n| [deleteAllProperties()](/apps-script/reference/properties/properties#deleteAllProperties()) | [Properties](/apps-script/reference/properties/properties) | Deletes all properties in the current `Properties` store. |\n| [deleteProperty(key)](/apps-script/reference/properties/properties#deleteProperty(String)) | [Properties](/apps-script/reference/properties/properties) | Deletes the property with the given key in the current `Properties` store. |\n| [getKeys()](/apps-script/reference/properties/properties#getKeys()) | `String[]` | Gets all keys in the current `Properties` store. |\n| [getProperties()](/apps-script/reference/properties/properties#getProperties()) | `Object` | Gets a copy of all key-value pairs in the current `Properties` store. |\n| [getProperty(key)](/apps-script/reference/properties/properties#getProperty(String)) | `String` | Gets the value associated with the given key in the current `Properties` store, or `null` if no such key exists. |\n| [setProperties(properties)](/apps-script/reference/properties/properties#setProperties(Object)) | [Properties](/apps-script/reference/properties/properties) | Sets all key-value pairs from the given object in the current `Properties` store. |\n| [setProperties(properties, deleteAllOthers)](/apps-script/reference/properties/properties#setProperties(Object,Boolean)) | [Properties](/apps-script/reference/properties/properties) | Sets all key-value pairs from the given object in the current `Properties` store, optionally deleting all other properties in the store. |\n| [setProperty(key, value)](/apps-script/reference/properties/properties#setProperty(String,String)) | [Properties](/apps-script/reference/properties/properties) | Sets the given key-value pair in the current `Properties` store. |\n\n[PropertiesService](/apps-script/reference/properties/properties-service)\n-------------------------------------------------------------------------\n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------------------------------------------------------------------------------|------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|\n| [getDocumentProperties()](/apps-script/reference/properties/properties-service#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()](/apps-script/reference/properties/properties-service#getScriptProperties()) | [Properties](/apps-script/reference/properties/properties) | Gets a property store that all users can access, but only within this script. |\n| [getUserProperties()](/apps-script/reference/properties/properties-service#getUserProperties()) | [Properties](/apps-script/reference/properties/properties) | Gets a property store that only the current user can access, and only within this script. |\n\n[ScriptProperties](/apps-script/reference/properties/script-properties)\n-----------------------------------------------------------------------\n\n[UserProperties](/apps-script/reference/properties/user-properties)\n-------------------------------------------------------------------"]]