author's avatar

General

How to Use Google Drive api with Python by ON November 26 2019

Whenever you want to use google drive with python for storing some kind of data at that for developing purpose you can use the below steps.

Step 1: Log-in your google drive(Gmail) account.

Step 2: Click on Link and follow 4 steps shows on the link page.

before performing the below steps

  • please make sure that python is installed and version should be greater then 2.6
  • The pip package management tool is installed.

Note: This blog is based on Google APi v3

  1. Enable(Turn on) Google drive API
  2. Install Google  Client Library
  3. Setup the sample (quickstart.py file)
  4. Run quickstart.py file using below command:

python quickstart.py

When you run quickstart.py file it will open a new tab in the default browser.

if you login into multiple accounts then you have to select any account where you want to save files. then click on Accept button and authentication completed.

Note: if it will fail to open the browser then copy url from command prompt and past it into a browser.

After authentication, you wanted to perform different operation on google drive like File-upload, file download, Search for file and folders, return specific field of file, Share file folder and drives, Manage file metadata, Add comment and reply, Add custom file properties.

Step 3: File upload refer to this link

Step 4: File Download refer to this link

Step 5: Search for file and folders refer to this link

Step 6: Return specific field of file refer to this link

Step 7: Share files, folders and drives refer to this link

Step 8: Manage file metadata refer to this link

Step 9: Add comment and reply refer to this link

Step 10: Add Custom Properties refer to this link

Note: for more details refer to this link

If you have any question then please comment.

 

Thank you :>)

    LEAVE A COMMENT

    Leave a Reply

    Your e-mail address will not be published. Required fields are marked *