-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtemplates.py
44 lines (41 loc) · 1.22 KB
/
templates.py
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
36
37
38
39
40
41
42
43
44
## RepeatCellRequest to change the background color on a range of cells
def backgroundColor(col, start, end, sheetId, color):
return({
"repeatCell" : {
"range" : {
"sheetId" : sheetId,
"startRowIndex" : start,
"endRowIndex" : end,
"startColumnIndex" : col,
"endColumnIndex" : col + 1,
},
"cell" : {
"userEnteredFormat" : {
"backgroundColor" : {
"red" : color[0] / 255,
"green" : color[1] / 255,
"blue" : color[2] / 255
}
}
},
"fields" : "userEnteredFormat.backgroundColor"
}
})
## AutoResizeDimensionsRequest to automatically resize a column
def resizeColumn(col, sheetId):
return({
"autoResizeDimensions" : {
"dimensions" : {
"sheetId" : sheetId,
"dimension" : "COLUMNS",
"startIndex" : col,
"endIndex" : col + 1
}
}
})
## BatchUpdateRequest entry
def batchValueEntry(r, v):
return({
"range" : r,
"values" : v
})