]> git.cworth.org Git - turbot/commitdiff
Set the name of newly-created sheets to match the channel name
authorCarl Worth <cworth@cworth.org>
Tue, 29 Sep 2020 22:12:24 +0000 (15:12 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 29 Sep 2020 22:12:24 +0000 (15:12 -0700)
Much better than having dozens of sheets all named "untitled".

turbot/sheets.py

index 50c472271da8c32dc2c48b664c338ec1b4f2b2f6..3d527359dda460f9a622b875a6acbb61de7c5a33 100644 (file)
@@ -35,7 +35,11 @@ def sheets_create(name):
     service = build('sheets', 'v4', credentials=creds)
 
     # Create a new sheet
-    spreadsheet_body = {}
+    spreadsheet_body = {
+        'properties': {
+            'title': name
+        }
+    }
 
     request = service.spreadsheets().create(body=spreadsheet_body)
     response = request.execute()