How to Upload Files to Google Drive Using Python 3 Using Google Drive API V3 Full Project

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
uh hello friends today in this tutorial i will be showing you that how to upload a file to google drive using python 3 so this way this is my blog here step by step blog if you go to the video description i have provided a link in the video description so go to this blog and here i have provided step by step instruction on how to do this so first of all you need to retrieve the access token so here you will be going to this website which is google api playground so here so let me just show you if you go to google here and if you type here google api playground so the very first result which comes in this is a website here you can see that after visiting this website you need to find the google drive api so whichever if you drag down here you will see this api drive api version 3 and now after this you need to select the different kinds kind of scopes that in order to necessary for uploading files so we only need the first scope which is this one so select the scope and after selecting the scope which has a check mark here you need to click on authorize apis and now in the next screen it will ask you to select your google account which google account that you want to upload files to let me select this third account and then it will ask for the permissions to grant to this project to upload files on your behalf so you need to simply click on the allow button after clicking allow it will have this authorization code for us we don't want this authorization code we want the access token so we need simply need to click this button so it will exchange this authorization code with access tokens so click this and now you will see that this is your brand new access token so this is access token you can see that so simply you need to copy this access token let me just copy this so just copy this and right here you need to make a simple in your root directory you need to make a app.py file so all the source code is given in my blog so that is why i tell you at the starting of the video so just go to this block so all the step by step instruction i have illustrated and this is a code here so simply copy this copy to clipboard and paste it so here inside your headers here you need to provide a access token here so again i need to go to so i think i have copy paste it yes this is accessory of mine so let me just copy this so simply i need to paste it here paste it so after pasting it here you need to provide a simple file name so i will provide here sample file dot png so after this you need to inside this you need to provide the path of the image where it should be uploaded so i have uploaded two images inside my root directory so i will upload this image which is image.png so let me just show you this is the image if i open this this is the image we will be uploading here to google drive so after all this is set up we are just at last we are making a post request to this route you can see that passing the headers and the files object so now simply go to the command prompt and execute this file which is python.app.py so if you execute this file a this object will be returned to you this random id will be assigned by this google drive api to the uploaded file this is the name of the file which is we have provided sample file.png and this is a meme type and now if i check here you will see that inside my drives folder this file will be uploaded here you will see that you can see that sample file dot png we have uploaded this file you can see that and the next thing that you can also do is that you can even provide a let's suppose if you want to create a folder here let's suppose if you have this folder here you need to upload files inside this folders so what we can do is that you can take the folder id so here you can copy base the folder id and inside this there is a second option is there which is parents and inside this you need to inside this array you need to pass the parent id like this that's it so this will upload this file inside this specific folder which is there inside my google drive which is images and now if i refresh this script and again run this and now you will see that it has uploaded this file inside this images folder so if i refresh this images folder so you will see that this file is uploaded right here sample file dot png so this was the simplest of tutorial on how to upload files to google drive using the google drive api version 3 in python and also you can upload to a specific folder as well by adding this parent's property for all the source code you can go to the video description visit my blog follow the step-by-step instruction and upload the files so please like the video subscribe the channel and i will be seeing you next video
Info
Channel: Coding Shiksha
Views: 34,530
Rating: undefined out of 5
Keywords: coding shiksha, how to upload to google drive, how to upload file to google drive using python, python google drive api download file, python google drive tutorial, python google drive, google drive api v3, google drive api v3 python, upload file to google drive using python, python drive api
Id: JwGzHitUVcU
Channel Id: undefined
Length: 6min 10sec (370 seconds)
Published: Sat Jul 25 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.