Skip to content

Commit

Permalink
Merge pull request #1013 from jansim/feature/spreadsheet_update_title
Browse files Browse the repository at this point in the history
Add ability to rename Spreadsheets (via a new Spreadsheet.update_title)
  • Loading branch information
lavigne958 committed Mar 21, 2022
2 parents f4c4780 + c23b6ba commit fe5bdc6
Show file tree
Hide file tree
Showing 3 changed files with 402 additions and 0 deletions.
20 changes: 20 additions & 0 deletions gspread/spreadsheet.py
Expand Up @@ -573,6 +573,26 @@ def list_named_ranges(self):
"namedRanges", []
)

def update_title(self, title):
"""Renames the spreadsheet.
:param str title: A new title.
"""
body = {
"requests": [
{
"updateSpreadsheetProperties": {
"properties": {"title": title},
"fields": "title",
}
}
]
}

response = self.batch_update(body)
self._properties["title"] = title
return response

def update_timezone(self, timezone):
"""Updates the current spreadsheet timezone.
Can be any timezone in CLDR format such as "America/New_York"
Expand Down

0 comments on commit fe5bdc6

Please sign in to comment.