How do I rename a (work)sheet in a Google Sheets spreadsheet using the API in Python? -


i have been trying/looking solve problem long while. have read documentation gspread , cannot find there way rename worksheet. of know how to? massively appreciate it! there indeed worksheet.title gives name of worksheet, cannot find way rename actual sheet.

thank in advance!

this extraction of library i've coded personally:

def _batch(self, requests):     body = {         'requests': requests     }     return self._service.spreadsheets().batchupdate(spreadsheetid=self.spreadsheetid, body=body).execute()  def renamesheet(self, sheetid, newname):     return self._batch({         "updatesheetproperties": {             "properties": {                 "sheetid": sheetid,                 "title": newname,             },             "fields": "title",         }     }) 

i think little effort, can implement code , obtain want. in order make batchupdate call, need spreadsheetid initialized service explained in python quickstart - google sheet api


Comments

Popular posts from this blog

testing - Detect whether test has failed within fixture -

Android: SharingActionView on swipe from bottom -

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -