GMail
Adding GMail as data source
Do the following to add GMail as data source:
- From the left navigation panel, click Lakehouse and then click Data Sources.
- From the upper right corner of the page, click the + New Data Source button to start the process of adding a new database.
- In the New Data Source page, click the GMail icon.
- Specify the following details to add GMail. Once you have connected a data source, the system immediately fetches its schema. After this schema retrieval process is complete you can browse and interact with the tables and data.
| Field | Description |
|---|---|
| Connection Name | Enter a unique name for the connection. |
| OAuth Client ID | Enter the Client ID for your Google Project. You can obtain this from the Google Cloud Console. |
| OAuth Client Secret | Enter the Client Secret for your Google Project. |
| Refresh Token | Provide the OAuth refresh token that allows DataGOL to maintain a persistent connection to your GMail account. |
| Include Spam and Trash | A boolean flag to determine whether messages from the SPAM and TRASH folders should be included in the results. |
- Click Submit.
Supported sync modes
- Full Refresh - Overwrite
- Full Refresh - Append
Supported streams
- profile: User profile information (no pagination).
- drafts: All draft messages in the account.
- labels: List of all labels in the account.
- labels_details: Detailed information for each label.
- messages: The content and metadata of all messages.
- threads: Groups of related messages.
GMail API Key Generation Guide
Step 1: Create Google Cloud Project and Enable API
- Go to Google Cloud Console
- Click "Select a project" dropdown at the top
- Click "New Project"
- Enter project name (e.g., "Gmail Integration")
- Click "Create"
- Wait for project creation to complete
- Enable Gmail API:
- Go to "APIs & Services" > "Library"
- Search for "Gmail API"
- Click on it and click "Enable"
Step 2: Create OAuth 2.0 Credentials
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth 2.0 Client IDs"
- If prompted, configure OAuth consent screen first:
- Click "Configure Consent Screen"
- Choose "External" (unless using Google Workspace)
- Fill required fields: App name, User support email, Developer contact
- Add your email to "Test users" if app is in testing mode
- Click "Save and Continue" through all steps
- Return to "Create Credentials" > "OAuth 2.0 Client IDs"
- Choose "Web application" as application type
- Enter name (e.g., "Gmail Sync")
- Under "Authorized redirect URIs", add:
https://developers.google.com/oauthplayground
- Click "Create"
- Save the Client ID and Client Secret that appear in the popup
Step 3: Generate Refresh Token
- Go to OAuth 2.0 Playground
- Click the gear icon (settings) in top right
- Check "Use your own OAuth credentials"
- Enter your Client ID and Client Secret from Step 2
- Click "Close"
- Select Gmail Scopes:
- In the left panel, find "Gmail API v1"
- Check the box for this scope
https://www.googleapis.com/auth/gmail.readonly
- Click "Authorize APIs" button
- Sign in with your Google account that has the Gmail you want to sync
- Grant permissions when prompted
- You'll be redirected back to the playground
- Click "Exchange authorization code for tokens"
- Copy the refresh_token from the response (starts with
1//)
Step 4: Configure Source on DataGOL using the credentials
client_id: From Step 2client_secret: From Step 2client_refresh_token_2(orrefresh_token): From Step 3
Step 5: Final Credentials Summary
You should have:
Client ID: [numbers]-[string].apps.googleusercontent.com
Client Secret: GOCSPX-[string]
Refresh Token: 1//[long-string]
Was this helpful?