2
votes

I would like to upload some files to my own Google drive from backend. There will be a script which will take the files from a particular folder and upload to my own drive.

I couldn't get my head around on how to do that. In the Google rest api, it mainly talks about OAuth and stuff. At the servers, I cannot open a browser and select a particular account.

Is there a way to generate some special keys that would help me directly upload to my google drive without OAuth?

PS: It would be great if someone can refer me to examples or code.

Links I visited:

and many more

Thanks!

1
What approach did you end up using?m01010011

1 Answers

2
votes

You should look into using a serivce account. Service accounts are dummy users they have their own drive account. So you could tecincally upload files to the service accounts google drive account however it has no UI view so all interaction with its drive account would have to be done though code.

Now why is this useful to you because service accounts can be preauthorized. You can take the service account email address share a directory on your personal google drive account with the service account like you would any other user and it will automatically be able to upload to that directly. Just watch-out for permissions remember to have it grant you permissions on the file or you may end up with files on your drive account that you dont own.

Here is a link to the documentation python service accounts