I am trying to update an existing file in Google drive
using python script
.
The code that I am using is:
fileID = wasFileUploadedBefore(drive, reportName) #this gets the fileID if it's already in GDrive
if fileID != 0:
reportFile = drive.CreateFile({'id': fileID})
else:
reportFile = drive.CreateFile({'title':reportName, 'mimeType':'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'})
reportFile.SetContentFile(reportName)
reportFile.Upload({'convert':True}) #convert=true is to convert the file to GoogleDrive Spreadsheet.
As I said when I am running the code the following error occurs:
raise ApiRequestError(error)
ApiRequestError: <HttpError 500 when requesting https://www.googleapis.com/upload/drive/v2/....&convert=true&alt=json returned "Internal Error">
Everything is good if I don't use {'convert':True}
tag in Upload, but I really need it because I want the file to be converted.
I'm trying to upload an .xlsx
file