You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 22, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 22, 2021. It is now read-only.
How can I upload a file to team drives folder? #149
I am having the same problem. I have searched everywhere but no luck so far. The GET request when I set up my CreateFile as follows seem to omit the teamSupport params:
This is the Get request captured in my logger: INFO:googleapiclient.discovery:URL being requested: GET https://www.googleapis.com/drive/v2/files/1omHKJUACcnyqaSaMJ3kvVsQ3U8E3Cm5Y?alt=json
I tried setting up as suggested with the nested params to no avail too:
I have the exact same question as @rarup1. I know @fergusleahytab has brought modifications to PyDrive, but I am still not sure how to modify @rarup1's code to download files from a shared folder (where to put 'supportsTeamDrives': True if there any need for it). Any help would be deeply appreciated.
I successfully upload the files to Shared Drive (Team Drive) with PyDrive.
In pydrive/files.py, about line 368. Add a line of code param['supportsAllDrives'] = True
Which should look like this:
Last, just simply use these code templet
f = drive.CreateFile({'title': '<file name, not really necessary>','parents': [{'id': '<your shared drive id>'}]})
f.SetContentFile(os.path.join(path, '<file in your local>'))
f.Upload()
Activity
spartako commentedon Dec 3, 2018
Just make sure your credentials have access to that Team Drive, and then add a few more parameters like so:
Once you get the ID, the process for uploading is as usual
chrisPiemonte commentedon Jan 16, 2019
I still can't upload files to team drives folder, but i can list them. This is my code to upload files:
I don't know if this is because of permissions or else, and i don't know how to check it either. Can anyone help me on this ?
bendavis78 commentedon Jan 25, 2019
@spartako How do you find the team drive id?
Imoustak commentedon Feb 4, 2019
@bendavis78
The ID of the Team Drive can be found at the last part of its URL
rlkc112358 commentedon Feb 8, 2019
Credits to this StackOverflow Answer
Here is my code which worked
hermannsblum commentedon Feb 26, 2019
This seems the right place to ask:
How can I download a file? Unfortunately, just adding the
supportsTeamDrivesflag does not help...rarup1 commentedon Feb 27, 2019
I am having the same problem. I have searched everywhere but no luck so far. The
GETrequest when I set up my CreateFile as follows seem to omit the teamSupport params:This is the Get request captured in my logger:
INFO:googleapiclient.discovery:URL being requested: GET https://www.googleapis.com/drive/v2/files/1omHKJUACcnyqaSaMJ3kvVsQ3U8E3Cm5Y?alt=jsonI tried setting up as suggested with the nested params to no avail too:
Like the above commenter said the
works fine.
Any help in getting it to send the correct Get request would be much appreciated.
Thanks!
keliomer commentedon May 24, 2019
@rarup1 you need to add query parameters to the ListFile() call
ie
file_list = drive.ListFile({'q':"title='yourfiletitle' and 'parent_id' in parents and trashed=false"}).GetList()Without the query params you're not actually looking for anything!
AstronoTech commentedon Nov 18, 2019
I have the exact same question as @rarup1. I know @fergusleahytab has brought modifications to PyDrive, but I am still not sure how to modify @rarup1's code to download files from a shared folder (where to put 'supportsTeamDrives': True if there any need for it). Any help would be deeply appreciated.
Kind regards,
Berti
cccat6 commentedon Apr 19, 2021
I successfully upload the files to Shared Drive (Team Drive) with PyDrive.

In pydrive/files.py, about line 368. Add a line of code
param['supportsAllDrives'] = TrueWhich should look like this:
Last, just simply use these code templet
Hopes it will help someone.
shcheklein commentedon Apr 19, 2021
@cccat6 you could also check the maintained PyDrive2 fork. It has that (and many other fixes) in it.
cccat6 commentedon Apr 19, 2021
Ops... I didn't notice there is a PyDrive2. Spends me an hour on positioning the point :(
Thank you for your inform.