How do you insert text into a specific Google spreadsheet by ID using pydrive2?

64 views Asked by At

I'm trying to write text into a Google spreadsheet, but it appears you can only write into the first tab.

Using this code only allows me to write to the first tab and none of the docs specify how to do it. https://docs.iterative.ai/PyDrive2/

google_file_ref = next(iter(drive.ListFile({'q':f"mimeType = 'application/vnd.google-apps.spreadsheet' and '{google_file_ref_id}' in parents and trashed=false",
        'maxResults': 10,
        'corpora': 'teamDrive',
        'teamDriveId': drive_id,
        'includeTeamDriveItems': True,
        'supportsTeamDrives': True}).GetList()))
google_file_ref.SetContentString(response.content.decode('utf-8'))
google_file_ref.Upload()
0

There are 0 answers