I try to download a Google Drive spreadsheet as an Excel file. As far as I can tell, the Google Drive API should make this very simple by just specifying a different mime type to the export_media request.
Based on the tutorial script I can successfully download the spreadsheet as CVS and Open Office sheet. Great!
However with the mime type set to application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - as specified for MS Excel the downloader continues to read from the stream without ever stopping and without increasing the status progress.
The full script is here. To run, follow the instructions to create an app in the Google Drive API docs here
The offending code is here:
file_id = 'my spreadsheet id'
request = service.files().export_media(fileId=file_id, mimeType='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
fh = FileIO('data.xls', 'wb')
downloader = MediaIoBaseDownload(fh, request)
done = False
while done is False:
status, done = downloader.next_chunk()
print("Download %d%%." % int(status.progress() * 100))
It continues to print Download 0% and never stops.