According to Google Drive documentation, to query for a file by name you would use: q="name = 'file name'".
https://developers.google.com/drive/v3/web/search-parameters
When I try to search by name here: https://developers.google.com/drive/v2/reference/files/list#try-it
Setting the "q" field to "name = 'file_name'".
"The value of the parameter 'q' is invalid." is returned.
The same thing happens when I try to execute the command in Python:\
service.files().list(q="name = 'file_name'").execute()
Other commands like q="trashed=false" work fine. Not sure why "name" queries do not.
Resolve a 403 error: Project rate limit exceededRaise the per-user quota in the Google Cloud project. For more information, request a quota increase. Batch requests to make fewer API calls. Use exponential backoff to retry the request.
The issue you are having is that you are attempting to use search parameters defined specifically for the Drive v3 API with the Drive v2 API.
When using the Drive v2 API, the name of the file is found under 'title', so a valid query is:
title = 'TestDoc'
Whereas in Drive v3 API, the name of the file is found under 'name':
name = 'TestDoc'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With