Skip to content

Instantly share code, notes, and snippets.

@jdraths
Last active September 15, 2017 17:36

Revisions

  1. jdraths revised this gist Sep 15, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Google Sheets API Zebra Striping (request body)
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    // params need to be snake cased with ruby api
    {
    "requests":
    [
  2. jdraths revised this gist Sep 15, 2017. 1 changed file with 65 additions and 66 deletions.
    131 changes: 65 additions & 66 deletions Google Sheets API Zebra Striping (request body)
    Original file line number Diff line number Diff line change
    @@ -2,18 +2,17 @@
    "requests":
    [
    {
    "setBasicFilter":
    {
    "filter":
    {
    "range":
    {
    "sheetId": 0
    }
    }
    }
    "setBasicFilter": {
    "filter":
    {
    "range":
    {
    "sheetId": 0
    }
    }
    }
    },
    {
    {
    "repeatCell": {
    "range": {
    "sheetId": 0,
    @@ -42,33 +41,33 @@
    "fields": "userEnteredFormat(backgroundColor,textFormat,horizontalAlignment)"
    }
    },
    {
    "updateBorders": {
    "range": {
    "sheetId": 0,
    "startRowIndex": 0,
    "endRowIndex": 0,
    },
    "top": {
    "style": "SOLID",
    "width": 1,
    "color": {
    "red": 1.0,
    "green": 1.0,
    "blue": 1.0
    },
    },
    "bottom": {
    "style": "SOLID",
    "width": 1,
    "color": {
    "red": 1.0,
    "green": 1.0,
    "blue": 1.0
    },
    },
    }
    },
    {
    "updateBorders": {
    "range": {
    "sheetId": 0,
    "startRowIndex": 0,
    "endRowIndex": 0,
    },
    "top": {
    "style": "SOLID",
    "width": 1,
    "color": {
    "red": 1.0,
    "green": 1.0,
    "blue": 1.0
    },
    },
    "bottom": {
    "style": "SOLID",
    "width": 1,
    "color": {
    "red": 1.0,
    "green": 1.0,
    "blue": 1.0
    },
    },
    }
    },
    {
    "updateSheetProperties": {
    "properties": {
    @@ -80,35 +79,35 @@
    "fields": "gridProperties.frozenRowCount"
    }
    },
    {
    "addBanding": {
    "bandedRange": {
    "bandedRangeId": 12346,
    "range": {
    "sheetId": 0,
    },
    "rowProperties": {
    "headerColor": {
    "red": 1,
    "green": 1,
    "blue": 1,
    "alpha": 1,
    },
    "firstBandColor": {
    "red": 0.89,
    "green": 0.89,
    "blue": 0.89,
    "alpha": 0,
    },
    "secondBandColor": {
    "red": 1,
    "green": 1,
    "blue": 1,
    "alpha": 0,
    }
    }
    }
    {
    "addBanding": {
    "bandedRange": {
    "bandedRangeId": 12346,
    "range": {
    "sheetId": 0,
    },
    "rowProperties": {
    "headerColor": {
    "red": 1,
    "green": 1,
    "blue": 1,
    "alpha": 1,
    },
    "firstBandColor": {
    "red": 0.89,
    "green": 0.89,
    "blue": 0.89,
    "alpha": 0,
    },
    "secondBandColor": {
    "red": 1,
    "green": 1,
    "blue": 1,
    "alpha": 0,
    }
    }
    }
    }
    }
    ]
    }
  3. jdraths created this gist Sep 15, 2017.
    114 changes: 114 additions & 0 deletions Google Sheets API Zebra Striping (request body)
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,114 @@
    {
    "requests":
    [
    {
    "setBasicFilter":
    {
    "filter":
    {
    "range":
    {
    "sheetId": 0
    }
    }
    }
    },
    {
    "repeatCell": {
    "range": {
    "sheetId": 0,
    "startRowIndex": 0,
    "endRowIndex": 1
    },
    "cell": {
    "userEnteredFormat": {
    "backgroundColor": {
    "red": 1.0,
    "green": 1.0,
    "blue": 1.0
    },
    "horizontalAlignment" : "LEFT",
    "textFormat": {
    "foregroundColor": {
    "red": 0.0,
    "green": 0.0,
    "blue": 0.0
    },
    "fontSize": 10,
    "bold": true
    }
    }
    },
    "fields": "userEnteredFormat(backgroundColor,textFormat,horizontalAlignment)"
    }
    },
    {
    "updateBorders": {
    "range": {
    "sheetId": 0,
    "startRowIndex": 0,
    "endRowIndex": 0,
    },
    "top": {
    "style": "SOLID",
    "width": 1,
    "color": {
    "red": 1.0,
    "green": 1.0,
    "blue": 1.0
    },
    },
    "bottom": {
    "style": "SOLID",
    "width": 1,
    "color": {
    "red": 1.0,
    "green": 1.0,
    "blue": 1.0
    },
    },
    }
    },
    {
    "updateSheetProperties": {
    "properties": {
    "sheetId": 0,
    "gridProperties": {
    "frozenRowCount": 1
    }
    },
    "fields": "gridProperties.frozenRowCount"
    }
    },
    {
    "addBanding": {
    "bandedRange": {
    "bandedRangeId": 12346,
    "range": {
    "sheetId": 0,
    },
    "rowProperties": {
    "headerColor": {
    "red": 1,
    "green": 1,
    "blue": 1,
    "alpha": 1,
    },
    "firstBandColor": {
    "red": 0.89,
    "green": 0.89,
    "blue": 0.89,
    "alpha": 0,
    },
    "secondBandColor": {
    "red": 1,
    "green": 1,
    "blue": 1,
    "alpha": 0,
    }
    }
    }
    }
    }
    ]
    }