I am trying to upload a .xlsx file to google drive. I am able to upload it. But when we try to open the same file in Drive, it has to be opened with Google Sheets. Thus, it creates a new file with same name and consumes Drive space.
I suppose I need to change the MimeType while uploading.
What I have tried is :
file = drive.CreateFile({"parents": [{"kind": "drive#fileLink", "id": FolderID}]
,'title': fileName
,'mimeType':'application/vnd.ms-excel'})
file.SetContentFile('12dec2018.xlsx')
file.Upload()
and I have also tried this one
'mimeType':'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
At Google documentation
I have found the other MimeType
'mimeType':'application/vnd.google-apps.spreadsheet'
But it gives me Error
ApiRequestError
: https://www.googleapis.com/upload/drive/v2/files?uploadType=resumable&alt=json returned "Invalid mime type provided">
Please suggest how could I achieve the desirable result.