INNER CODE UNIT · Python
delete_workbook
Squarespace/datasheets · datasheets/client.py:284
def delete_workbook(self, filename=None, file_id=None):
"""Delete a workbook from Google Drive
Either filename (i.e. title) or file_id should be provided. Providing file_id is preferred
as it is more precise.
Args:
filename (str): The name of the workbook to delete
file_id (str): The ID of the workbook to delete
Returns:
None
"""
if (filename is None) == (file_id is None):
raise ValueError('Either filename or file_id must be provided, but not both.')
if not file_id:
file_id = self._fetch_file_id(filename=filename, kind='spreadsheet')
self.drive_svc.files().delete(fileId=file_id).execute()