Search code examples
pythonpython-3.xgoogle-drive-api

List of files in a google drive folder with python


I've got the exact same question as the one asked on this post: List files and folders in a google drive folder I don't figure out in the google drive rest api documentation how to get a list of files in a folder of google drive


Solution

  • You can look here for an example of how to list files in Drive: https://developers.google.com/drive/api/v3/search-files . You need to construct a query that lists the files in a folder: use

    q = "'1234' in parents"
    

    where 1234 is the ID of the folder that you want to list. You can modify the query to list all the files of a particular type (such as all jpeg files in the folder), etc.