INNER CODE UNIT · Python
_fetch_file_id
Squarespace/datasheets · datasheets/client.py:148
def _fetch_file_id(self, filename, kind):
"""Return the file_id for the Google Drive file with the specified filename (i.e. title).
If multiple files exist with the specified filename, an exception is raised with
information about each file, including its filename, file_id, the datetime it was last
modified, and a webViewLink URL to look at the file. The user will be directed to use
the appropriate file_id in their function instead.
Args:
filename (str): The name of the workbook we want to fetch the file_id for
kind (str): Either 'spreadsheet' or 'folder'
Returns:
str: The file ID for the specified file
"""
matches = []
for f in self._fetch_info_on_items(kind=kind, name=filename):
matches.append(f)