-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpropsCode.gs
33 lines (28 loc) · 881 Bytes
/
propsCode.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function getProperties() {
let props = PropertiesService.getDocumentProperties().getProperties();
return props;
}
function setProperties(key, value){
let props = PropertiesService.getDocumentProperties();
props.setProperty(key, value);
return true;
}
function showPropDialog(){
let info = showPrompt_();
setProperties(info.key, info.value);
let rslt = getProperties();
SpreadsheetApp.getUi().alert(JSON.stringify(rslt));
console.log(rslt);
}
function showPrompt_(){
let ans = {};
let ui = SpreadsheetApp.getUi();
let ans1 = ui.prompt("Key", "Whats the key name?", ui.ButtonSet.OK_CANCEL);
ans.key = ans1.getResponseText();
let ans2 = ui.prompt("Value", "Whats the value?", ui.ButtonSet.OK_CANCEL);
ans.value = ans2.getResponseText()
return ans;
}
function deleteProps(){
PropertiesService.getDocumentProperties().deleteAllProperties();
}