API Reference

Update sheet formatting

Description

Asynchronously submits a SheetUpdate to a sheet. Each SheetUpdate can have only one update field set per request.

POST /spreadsheets/{spreadsheetId}/sheets/{sheetId}/update

🚧

Required OAuth Scopes:

file:write

Parameters

ParameterInTypeRequiredDescription
spreadsheetIdpathstringtrueThe unique identifier of the spreadsheet
sheetIdpathstringtrueThe unique identifier of the sheet
bodybodySheetUpdatetrueA SheetUpdate

Body parameter example

{
  "applyBorders": {
    "borders": [
      {
        "bottom": {
          "color": "#4bdf58",
          "style": "SINGLE",
          "weight": 1
        },
        "innerHorizontal": {
          "color": "#4bdf58",
          "style": "SINGLE",
          "weight": 1
        },
        "innerVertical": {
          "color": "#4bdf58",
          "style": "SINGLE",
          "weight": 1
        },
        "left": {
          "color": "#4bdf58",
          "style": "SINGLE",
          "weight": 1
        },
        "ranges": [
          {
            "startColumn": 0,
            "startRow": 0,
            "stopColumn": 0,
            "stopRow": 0
          }
        ],
        "right": {
          "color": "#4bdf58",
          "style": "SINGLE",
          "weight": 1
        },
        "top": {
          "color": "#4bdf58",
          "style": "SINGLE",
          "weight": 1
        }
      }
    ]
  },
  "applyFormats": {
    "formats": [
      {
        "cellFormat": {
          "backgroundColor": "#4bdf58",
          "horizontalAlign": "LEFT",
          "indent": {
            "unit": "INCHES",
            "value": 0
          },
          "leaderDots": "NARROW",
          "textRotation": "HORIZONTAL",
          "verticalAlign": "TOP"
        },
        "ranges": [
          {
            "startColumn": 0,
            "startRow": 0,
            "stopColumn": 0,
            "stopRow": 0
          }
        ],
        "textFormat": {
          "bold": true,
          "fontColor": "#4bdf58",
          "fontFamily": "Times New Roman",
          "fontSize": 12,
          "italic": true,
          "strikethrough": true,
          "underline": true
        },
        "valueFormat": {
          "currencySymbol": {
            "currency": {
              "code": "AUD",
              "display": "SYMBOL"
            },
            "generic": "DOLLAR"
          },
          "dateAbbreviateMonth": true,
          "dateFormatString": "d/m/yyyy",
          "dateUppercaseAll": true,
          "displayZeroAs": "ZERO",
          "enteredIn": "BASIS POINTS",
          "numbersAsWordsOptions": {
            "capitalizeFirstWord": false,
            "displayZeroAs": "ZERO"
          },
          "percentSymbol": "NONE",
          "periodFormat": {
            "capitalizeFirstWord": false,
            "display": "RAW",
            "precision": null,
            "separator": "NONE",
            "showLabels": true,
            "showNumbersAsWords": false
          },
          "precision": {
            "auto": false,
            "value": -15
          },
          "prefix": "string",
          "showCurrencySymbol": true,
          "showLeadingZero": true,
          "showNumbersAsWords": true,
          "showPositiveSign": true,
          "showSignRoundedZero": true,
          "showThousandsSeparator": true,
          "shownIn": "BASIS POINTS",
          "suffix": "string",
          "symbolAlign": "LEFT",
          "useParensForNegatives": true,
          "valueFormatType": "AUTOMATIC"
        }
      }
    ]
  },
  "clearBorders": {
    "ranges": [
      {
        "startColumn": 0,
        "startRow": 0,
        "stopColumn": 0,
        "stopRow": 0
      }
    ]
  },
  "clearFormats": {
    "cellFormatFields": [
      "indent",
      "backgroundColor",
      "leaderDots"
    ],
    "ranges": [
      {
        "startColumn": 0,
        "startRow": 0,
        "stopColumn": 0,
        "stopRow": 0
      }
    ],
    "textFormatFields": [
      "bold",
      "italic",
      "underline"
    ],
    "valueFormatFields": [
      "shownIn",
      "precision",
      "currencySymbol"
    ]
  },
  "deleteColumns": {
    "force": true,
    "intervals": [
      {
        "end": 0,
        "start": 0
      }
    ]
  },
  "deleteRows": {
    "force": true,
    "intervals": [
      {
        "end": 0,
        "start": 0
      }
    ]
  },
  "editCells": {
    "cells": [
      {
        "column": 0,
        "row": 0,
        "value": null
      }
    ]
  },
  "editRange": {
    "range": {
      "startColumn": 0,
      "startRow": 0,
      "stopColumn": 0,
      "stopRow": 0
    },
    "values": [
      [
        null
      ]
    ]
  },
  "hideColumns": {
    "force": true,
    "intervals": [
      {
        "end": 0,
        "start": 0
      }
    ]
  },
  "hideRows": {
    "force": true,
    "intervals": [
      {
        "end": 0,
        "start": 0
      }
    ]
  },
  "insertColumns": {
    "inheritFrom": "NONE",
    "insertions": [
      {
        "count": 1,
        "index": 0
      }
    ]
  },
  "insertRows": {
    "inheritFrom": "NONE",
    "insertions": [
      {
        "count": 1,
        "index": 0
      }
    ]
  },
  "mergeRanges": {
    "force": true,
    "mergeType": "ALL",
    "ranges": [
      {
        "startColumn": 0,
        "startRow": 0,
        "stopColumn": 0,
        "stopRow": 0
      }
    ]
  },
  "resizeColumns": {
    "resizeIntervals": [
      {
        "intervals": [
          {
            "end": 0,
            "start": 0
          }
        ],
        "size": 3
      }
    ]
  },
  "resizeColumnsToFit": {
    "intervals": [
      {
        "end": 0,
        "start": 0
      }
    ]
  },
  "resizeRows": {
    "resizeIntervals": [
      {
        "intervals": [
          {
            "end": 0,
            "start": 0
          }
        ],
        "size": 3
      }
    ]
  },
  "resizeRowsToFit": {
    "intervals": [
      {
        "end": 0,
        "start": 0
      }
    ]
  },
  "unhideColumns": {
    "intervals": [
      {
        "end": 0,
        "start": 0
      }
    ]
  },
  "unhideRows": {
    "intervals": [
      {
        "end": 0,
        "start": 0
      }
    ]
  },
  "unmergeRanges": {
    "ranges": [
      {
        "startColumn": 0,
        "startRow": 0,
        "stopColumn": 0,
        "stopRow": 0
      }
    ]
  }
}

Code Samples

curl -X POST https://api.app.wdesk.com/platform/v1/spreadsheets/{spreadsheetId}/sheets/{sheetId}/update  \ 
-H 'Content-Type: application/json' \ 
-H 'Authorization: Bearer {access-token}'
http POST https://api.app.wdesk.com/platform/v1/spreadsheets/{spreadsheetId}/sheets/{sheetId}/update  \ 
Content-Type:application/json \ 
Authorization:"Bearer {access-token}"
wget --method=POST "https://api.app.wdesk.com/platform/v1/spreadsheets/{spreadsheetId}/sheets/{sheetId}/update" \
 --output-document -  \ 
 --header 'Content-Type: application/json' \ 
 --header 'Authorization: Bearer {access-token}'
import requests
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('https://api.app.wdesk.com/platform/v1/spreadsheets/{spreadsheetId}/sheets/{sheetId}/update', headers = headers)

print(r.json())

Returns

202 - Accepted

HeaderDescription
LocationThe location to poll for the operation result.
Retry-AfterThe number of seconds to wait before polling for a result and between polling attempts.