// Sets three properties of different types.constdocumentProperties=PropertiesService.getDocumentProperties();constscriptProperties=PropertiesService.getScriptProperties();constuserProperties=PropertiesService.getUserProperties();documentProperties.setProperty('DAYS_TO_FETCH','5');scriptProperties.setProperty('SERVER_URL','http://www.example.com/MyWeatherService/',);userProperties.setProperty('DISPLAY_UNITS','metric');
取得屬性儲存庫 (僅限此指令碼),所有使用者都能在開啟的文件、試算表或表單中存取。只有在指令碼以外掛程式形式發布及執行,或繫結至 Google 檔案類型時,才能使用這項功能。如果無法取得文件屬性,這個方法會傳回 null。指令碼建立的文件屬性無法在該指令碼之外存取,即使是其他指令碼存取相同文件也一樣。
回攻員
Properties:這個指令碼專用的屬性儲存庫,目前文件的所有使用者都能存取;如果指令碼不是外掛程式,或未繫結至 Google Workspace 檔案,則為 null
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2024-12-22 (世界標準時間)。"],[[["The Properties Service lets Apps Script store simple data as key-value pairs, with different scopes for scripts, users, and documents."],["It offers three methods to access properties: `getDocumentProperties()`, `getScriptProperties()`, and `getUserProperties()`."],["`getDocumentProperties()` provides property storage accessible to all users within a specific document, spreadsheet, or form where the script is running."],["`getScriptProperties()` allows storing properties accessible to all users, but only within the context of the current script."],["`getUserProperties()` provides a property store specific to the current user and accessible only within the current script."]]],[]]