-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathclient.gs
35 lines (27 loc) · 823 Bytes
/
client.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
34
35
// Function to cache spreadsheet to s3 with table-service server
// Call on-demand or however you like
function cacheChanges() {
var key = SpreadsheetApp.getActiveSpreadsheet().getId();
var payload =
{
"key" : key
};
var options =
{
"method" : "post",
"payload" : payload
};
UrlFetchApp.fetch("http://example.com/cgi-bin/table-service/server.py", options);
}
// This cache may save a "short" version of your spreadsheet's key
// You can check it with a menu option
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [ {name: "Get key...", functionName: "getCode"} ];
ss.addMenu("Key", menuEntries);
}
function getCode() {
var key = SpreadsheetApp.getActiveSpreadsheet().getId();
var msg = key;
Browser.msgBox(msg);
}