Android List All Google Drive Files by File Type (Mime Type)

April 6, 2019
List All Google Drive Sheets/Spreadsheets Files
var pageToken: String? = null
do {
    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:

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.