Google Drive as a Source
Google Drive is a cloud storage service developed by Google, which allows users to store files in the cloud. This page contains the setup guide and reference information for the Google Drive source connector.
Pre-requisites
- Google Cloud Console Account: Make sure you have a Google account and can access the Google Cloud Console.
- Google Folder URL: URL for the folder you want to sync.
- OAuth Credentials:
- Client ID: Client ID for the Google Drive API.
- Client Secret: Client Secret for the Google Drive API.
- Refresh Token: Refresh Token for the Google Drive API.
Note: To obtain the Google OAuth credentials for your source, please follow the setup guide below. If you already have them, you can skip the setup guide and create your source.
Setup Guide
Step 1: OAuth Consent Screen
- Go to the Google Cloud Console. Create a new project if you don't have one.
- Navigate to APIs & Services > OAuth consent screen.
- Complete the app registration form, then click Save and Continue.
Step 2: Create OAuth2 Credentials
Next, you’ll need to create OAuth2 credentials from the Google Cloud Console. These credentials provide authorization to access files from your Google Drive.
- Go to the Google Cloud Console.
- Navigate to APIs & Services > Credentials > Create credentials > OAuth Client IDs.
- Choose Desktop as the application type.
- Input the name and click on CREATE.
- Download the JSON file containing your OAuth2 credentials.
Step 3: Generate Token File
Now, execute the following code to generate a token.json
file.
Installing Dependencies
pip install google-auth google-auth-oauthlib google-auth-httplib2 google-api-python-client