I have excel file it contain one sheet it contain image. I need convert this excel file to google spreadsheet using python.
I can create google spreadsheet using api and add my text data but i can't to add image. This way does not suit me.
But I can to generate excel file contained image. Now I need export excel sheet to google spreadsheet.
How i can do it?
You just need to know the fileId
and specify the option convert=True
.
For example:
service.files().copy(fileId=file_id, convert=True, body={"title": "Chose a title"}).execute()
file_metadata = {
'name': 'Desired Name',
'mimeType': 'application/vnd.google-apps.spreadsheet'
}
media = MediaFileUpload('files/myExcelFile.xls',
mimetype='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
resumable=True)
file = drive_service.files().create(body=file_metadata,
media_body=media,
fields='id').execute()
print 'The converted file is on your Google Drive and has the Id: %s' % file.get('id')