I am using PyDrive to create files in Google Drive, but I'm having trouble with the actual Google Doc type items.
My code is:
file = drive.CreateFile({'title': pagename,
"parents": [{"id": folder_id}],
"mimeType": "application/vnd.google-apps.document"})
file.SetContentString("Hello World")
file.Upload()
This works fine if I change the mimetype to text/plain
but as is it gives me the error:
raise ApiRequestError(error) pydrive.files.ApiRequestError: https://www.googleapis.com/upload/drive/v2/files?uploadType=resumable&alt=json returned "Invalid mime type provided">
It also works fine if I leave the MimeType as is, but remove the call to SetContentString, so it appears those two things don't behave well together.
What is the proper way to create a Google Doc and set the content?