var pageToken: String? = nulldo { val result = googleDriveService.files().list().apply { q = "mimeType='application/vnd.google-apps.spreadsheet'" spaces = "drive" fields = "nextPageToken, files(id, name)" this.pageToken = pageToken }.execute() for (file in result.files) { Timber.d("name=${file.name}, id=${file.id}") }} while (pageToken != null)
NOTE:
googleDriveService
is Drive- Refer to Setup Android Google Drive REST API (Java/Kotlin) to get
googleDriveService
/Drive
instance. - Refer to search files example and parameters
- Refer to Mime Types for Google Drive files (e.g. Docs, Sheets, Slides, etc.)