I am trying to download a file from Google Drive using the PyDrive V3 Version.
I am really confused about the functions get_media() and export() which are to download the files. What is the difference?
The get_media() function works with excel files and not csv files whereas the export() function works with csv files and not excel files. What is the reason? I have tried changing the mimetype based on the file but that does not change the results.
Well I found the answer:
https://developers.google.com/drive/v3/web/manage-downloads
Depending on the type of file,the function used to download the file would change.
Depending on the type of download you'd like to perform — a file, a Google Document, or a content link — you'll use one of the following URLs:
- Download a file — files.get with alt=media file resource
- Download and export a Google Doc — files.export
- Link a user to a file — webContentLink from the file resource
I had excel files uploaded into Google Drive which were not changed so get_media() function worked with those whereas I had some csv files which were changed using Google Sheets and hence export function worked with that.
I do not like this way of separating functions for downloading content though. This is really confusing.