Is your feature request related to a problem? Please describe.
It would be nice to be able to trash a spreadsheet instead of fully deleting it. The following code shows how to do it when using API v3. There's no rush on this, but we are implementing this ourselves, and I thought it would be good to share. Thanks!
Describe the solution you'd like
def trash_spreadsheet(client, file_id: str):
"""Trash a spreadsheet.
Args:
file_id: The id of the spreadsheet to trash.
Returns:
The updated file metadata.
"""
# First retrieve the file from the API.
file = client.drive.service.files().get(fileId=file_id, fields="trashed", supportsAllDrives=True).execute()
# File's new metadata.
file['trashed'] = True
# Send the request to the API.
updated_file = client.drive.service.files().update(fileId=file_id, body=file, supportsAllDrives=True).execute()
return updated_file
Is your feature request related to a problem? Please describe. It would be nice to be able to trash a spreadsheet instead of fully deleting it. The following code shows how to do it when using API v3. There's no rush on this, but we are implementing this ourselves, and I thought it would be good to share. Thanks!
Describe the solution you'd like
Any other info Any other info