INNER CODE UNIT · Python
create_workbook
Squarespace/datasheets · datasheets/client.py:262
def create_workbook(self, filename, folders=()):
"""Create a blank workbook with the specific filename
Args:
filename (str): The name to give to the new workbook
folders (tuple): An optional tuple of folders to add the new workbook to
Returns:
datasheets.Workbook: An instance of the newly created workbook
"""
root_file_id = self.drive_svc.files().get(fileId='root', fields='id').execute()['id']
folders = [self._fetch_file_id(filename=f, kind='folder') for f in folders]
folders = [root_file_id] + list(folders)
body = {
'mimeType': 'application/vnd.google-apps.spreadsheet',
'name': filename,
'parents': folders