Class PropertiesService
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
PropertiesService
允許指令碼將簡單資料儲存在範圍限定一個指令碼的鍵/值組合中,也就是一位使用者
或需要附加外掛程式的文件不過,不同指令碼之間無法共用屬性。
如要進一步瞭解各種資源類型的使用時機,請參閱屬性服務指南。
// Sets three properties of different types.
var documentProperties = PropertiesService.getDocumentProperties();
var scriptProperties = PropertiesService.getScriptProperties();
var 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
:此指令碼的屬性儲存庫,只讓目前文件的所有使用者都能
存取,如果指令碼並非外掛程式或繫結至 Googlenull
工作區檔案
getScriptProperties()
取得所有使用者都能存取,但僅限此指令碼中的房源存放區。
回攻員
Properties
:指令碼所有使用者皆可存取的資源儲存庫
getUserProperties()
取得只有目前使用者可以存取的資源儲存庫,且只能在此指令碼中存取。
回攻員
Properties
:只有指令碼目前使用者可存取的屬性儲存庫
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-09-12 (世界標準時間)。
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"缺少我需要的資訊"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"過於複雜/步驟過多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"過時"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻譯問題"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/程式碼問題"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"容易理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"確實解決了我的問題"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]
{"lastModified": "\u4e0a\u6b21\u66f4\u65b0\u6642\u9593\uff1a2024-09-12 (\u4e16\u754c\u6a19\u6e96\u6642\u9593)\u3002"}
[[["容易理解","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-09-12 (世界標準時間)。"]]