(February 2017) Starting with Google I / O 2016 , developers can now format cells in Google Sheets using the latest API (v4). Here's a short Python example that highlights the 1st line (assuming the file identifier SHEET_ID and SHEETS are the API service endpoint):
DATA = {'requests': [ {'repeatCell': { 'range': {'endRowIndex': 1}, 'cell': {'userEnteredFormat': {'textFormat': {'bold': True}}}, 'fields': 'userEnteredFormat.textFormat.bold', }} ]} SHEETS.spreadsheets().batchUpdate( spreadsheetId=SHEET_ID, body=DATA).execute()
I also made a developer video on this subject if that helps (see below). BTW, you are not limited to Python, you can use any language supported by the Google API client libraries .
The latest Sheets API provides functions not available in older versions, namely providing developers with programmatic access to the Sheet as if you were using the user interface (frozen rows, formatting cells [!], Resizing rows / columns, adding pivot tables, creating charts and etc.). If you are new to the API, I created some videos with a few more βrealβ examples:
As you can say, the table API is mainly intended for document- oriented functionality, as described above, but for executing a file- level access, such as import / export, copy, move, rename, etc. instead of the Google Drive API .
wescpy
source share