I am trying to create a new file and upload it to Google Drive with Python using Google API libraries. On the official tutorial I have only found how to upload an existing file or create a folder, but I cannot figure out how to create a completely new file with a content.
This is basically a function to create a directory
def CreateFolder(name,DRIVE):
file_metadata = {
'name' : name,
'mimeType' : 'application/vnd.google-apps.folder'
}
file = DRIVE.files().create(body=file_metadata,
fields='id').execute()
print('Folder ID: %s' % file.get('id'))
Is there a way to create a new file and upload it?
Thanks