0

Is it possible to get files inside Google Shared Drive? PyDrive is able to iterate over files in MyDrive but not Shared Drive. The files are inside multiple folders:

Department -> PDF -> MONTH YEAR -> DATE -> DAILY REPORT.pdf

Codes tried but both returned "To look folder level":

# #Make GoogleDrive instance with Authenticated GoogleAuth instance
# drive = GoogleDrive(gauth)
f = drive.ListFile({"q": "mimeType='application/vnd.google-apps.folder' and trashed=false}).GetList()

for folder in f:
    print(folder['title'], folder['id'])

To look file level:

# # Auto-iterate through all files that matches this query
# file_list = drive.ListFile({'q': "'{}' in parents and trashed=false".format(folder_id)}).GetList()
# # print(file_list)
# for file1 in file_list:
#   print('title: %s, id: %s' % (file1['title'], file1['id']))
user4157124
  • 2,809
  • 13
  • 27
  • 42
MarthaF
  • 187
  • 2
  • 17

1 Answers1

5

Found a similar case. It works now using the codes:

# file_list =  drive.ListFile({'q':"'<Team_Drive_Id_Or_Folder_Id>' in parents and trashed=false", 'corpora': 'teamDrive', 'teamDriveId': '<Team_Drive_Id>', 'includeTeamDriveItems': True, 'supportsTeamDrives': True}).GetList()

How can I access a Team Drive instead of personal Google Drive using PyDrive?

MarthaF
  • 187
  • 2
  • 17