简体   繁体   中英

**How to list the contents of Multiple folder in Python Google Drive API?

I am trying to programmatically list the contents of multiple folders. But somehow unable to put variable in

queryt = f'{parent_folder_id} in parents'
while True:
    response = service.files().list(q=f'{queryt}',
                                    spaces='drive',
                                    fields='nextPageToken, files(id, name)',
                                    pageToken=page_token).execute()

The first variable q in service.files().list doesn't seem to accept variable but accepts direct values.

Is there any way to solve this issue?

Thanks

For anyone looking for the above issue can try.

        response = gdrive_service.files().list(
        q="parents in '"
          + folder_id + "' and trashed =""false",
        fields="nextPageToken, ""files(id, name)",
        pageSize=400).execute()

Thank you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM