def renameSheet(turb, url, newName):
id = extractIdFromSheetUrl(url)
- turb.sheets.batchUpdate(body={
- "updateSheetProperties": {
- "properties": {
- "spreadsheetId": id,
- "title": newName
- }
- }}).execute()
+ requests = []
+ requests.append({
+ 'updateSpreadsheetProperties': {
+ 'properties': {
+ 'title': newName
+ },
+ 'fields': 'title'
+ }
+ })
+
+ body = {
+ 'requests': requests
+ }
+
+ turb.sheets.batchUpdate(spreadsheetId = id,
+ body=body
+ ).execute()
def extractIdFromSheetUrl(url):
# Google sheet ids are between the /d/ and /edit in the url, like https://docs.google.com/spreadsheets/d/1dxHBzjenjhCAJQ8lM0skJO2mxlup8aWZm0-LaXeVPrg/edit#gid=0