Upload to Google Drive without any UI?

Here are the instructions for Windows, Linux and MacOS using GitHub | gdrive.

$ gdrive list
Go to the url... enter the oauth verification code... OK
$ gdrive upload file
$ gdrive mkdir UploadDir
ID_of_UploadDir
$ gdrive sync upload LocalDir ID_of_UploadDir

gdrive solution is not working as of now(login problems). So you can now use rclone. You can install it with

conda install -c conda-forge rclone

Then follow the configuration doc https://rclone.org/drive/
After configuration you will be able to copy to google drive with this command(stat flags are for progress bar)

rclone copy <filename> remote: --stats-one-line -P --stats 2s

rclone has many backends included so you can upload not only to google drive


Your application needs the user's permission to use the API against his files. That authorisation needs to happen using web based Oauth. The result of that authorisation is your server app ends up with a refresh token, which it can store. At any time, your app can convert that refresh token to an access token and access the drive files.

So, provided you accept that you need to do a one-time authorisation, you can achieve what you are looking for.