I’m exploring a Python solution within my GAE project to create a file (for instance, an XML generated from a database) and add it directly to Google Drive via API V2—without needing a manual file upload process.
In my work with Google App Engine and the Google Drive API V2, I implemented file creation directly from data without a manual upload step. I developed a routine that programmatically built metadata for the new file, then used the google-api-python-client to call the corresponding file insertion method with the file content streamed in memory. This approach required careful configuration of OAuth credentials and MIME types to ensure successful uploads. My experience shows that once these initial challenges are overcome, integrating file generation and upload is both efficient and practical.
I encountered a similar requirement in one of my projects where I needed to dynamically generate an XML file from database contents and directly upload it to Google Drive using API V2. I found that initializing a Drive service using the google-api-python-client was a straightforward solution. After building a metadata object for the file, I used MediaFileUpload to stream the contents during the upload process. This method streamlined the workflow and eliminated manual steps, offering an efficient way to integrate file creation and upload in one automated process.
hey i used a similar method in my gae app. i built file meta and called the insert method via the google api python client. sometimes, rechecking oauth creds & drive perms helped. it worked fine in my project.