jason jason - 1 year ago 86
Python Question

pydrive: how do I rename the title of a google spreadsheet once I know the id?

Here under
"Update file metadata" it shows how to change the title from a created file. I'm looking for how to change the title if I know the id or key. Or is there a way to do it in


Answer Source

You can also do this directly with PyDrive. CreateFile() only creates a local Python object to represent the state of a new or existing file

# CreateFile() can be called with an existing id.
file1 = drive.CreateFile({'id': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'})

file1['title'] = '<new title>' # Change title.
file1.Upload()                 # Upload new title.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download