I want to upload a file to Google Docs with a script, to avoid doing it manually over and over again.

Is there a way to do that simpler than scripting this with a Selenium what would be really fragile?

To avoid XY problem: I have an .ods file on my Lubuntu OS that I want to have regularly copied to my Android phone in human-readable format.

I am not interested in mounting Google Drive - there is a separate question for that and accepted is not giving the ability to manipulate Google Docs.

  • Google Drive seems to have a REST API available for uploads. You could use curl to script it. – Haxiel Nov 12 '18 at 9:50
  • @Haxiel Thanks! I am now writing a Python script. Can you make an answer that would be basically link to API docs (I may edit in my code into the answer) so I can mark you as the answerer? – Mateusz Konieczny Nov 24 '18 at 15:28
  • Sure, I'll add a brief answer here pointing to the relevant sections of the API docs. – Haxiel Nov 24 '18 at 16:06
  • @Haxiel And now, as I have working code I also added it to the answer as promised. I must say that Google API has quite good documentation, at least for people starting to use it. – Mateusz Konieczny Nov 25 '18 at 9:25

Google Drive provides a REST API which can be used for integration.

Since file uploads are a core part of Google Drive's functionality, the API allows for different types of uploads: simple uploads, multi-part uploads, and resumable uploads. The details can be found at this link: Uploading Files.

Since you are planning to use Python for this task, a quickstart guide for Python is also available, including sample code to get you started.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.