From: justin melvin <jmelvinprime@gmail.com>
Date: Sat, 28 Nov 2020 06:16:48 +0000 (-0800)
Subject: Finally I found out how to make the stupid batch API work
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=7805d0f829b99bf8a52be43e42e6fcaf1ea261e5;p=turbot

Finally I found out how to make the stupid batch API work
---

diff --git a/turbot/sheets.py b/turbot/sheets.py
index 434665e..921b51a 100644
--- a/turbot/sheets.py
+++ b/turbot/sheets.py
@@ -81,13 +81,23 @@ def sheets_create_for_puzzle(turb, puzzle):
 
 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