INNER CODE UNIT · Python
fetch_workbook
Squarespace/datasheets · datasheets/client.py:317
def fetch_workbook(self, filename=None, file_id=None):
"""Fetch a workbook
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 fetch
file_id (str): The ID of the workbook to fetch
Returns:
datasheets.Workbook: An instance of the requested workbook
"""
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')
return Workbook(filename, file_id, self, self.drive_svc, self.sheets_svc)