Google Drive

Connect your Google Drive to automatically sync documents, spreadsheets, presentations, and other files into your Twig AI knowledge base.

Overview

Property
Details

Type

Dynamic

Refresh

Scheduled (Daily, Weekly, Monthly)

Tier

1 (All Plans)

Authentication

OAuth 2.0

Supported Files

Docs, Sheets, Slides, PDFs, and more

When to Use Google Drive Connector

The Google Drive connector is ideal for:

  • Collaborative Documentation - Google Docs, Sheets, Slides

  • Team Knowledge Bases - Shared folders and team drives

  • Living Documents - Content that changes frequently

  • Multi-Author Content - Documents with multiple contributors

  • Cloud-Native Workflows - Organizations using Google Workspace

Supported File Types

Google Workspace Files

  • Google Docs (.gdoc) - Exported as HTML/text

  • Google Sheets (.gsheet) - Exported as CSV/Excel

  • Google Slides (.gslides) - Exported as PDF/PowerPoint

  • Google Forms (.gform) - Form descriptions

Uploaded Files

  • PDF (.pdf) - Portable Document Format

  • Word (.doc, .docx) - Microsoft Word

  • Excel (.xls, .xlsx) - Microsoft Excel

  • PowerPoint (.ppt, .pptx) - Microsoft PowerPoint

  • Text (.txt) - Plain text files

  • Images (.jpg, .png, .gif) - Image files with text extraction

How to Set Up Google Drive Connector

Step 1: Navigate to Data Sources

  1. Log in to your Twig AI account

  2. Click Data in the main navigation menu

  3. Click Add Data Source or the + button

  4. Choose Google-Drive from the list of connectors

Step 2: Configure Basic Information

  • Name (required): Descriptive name for this connection

    • Example: "Team Documentation", "Product Specs", "Marketing Materials"

  • Description (optional): Additional context

    • Example: "Product documentation folder shared with engineering team"

  • Tags (optional): Organizational tags

    • Examples: "google-drive", "documentation", "internal"

Step 3: Authenticate with Google

  1. Click Connect Google Drive or Authorize

  2. You'll be redirected to Google's authorization page

  3. Sign in with your Google account

  4. Review the permissions requested:

    • Read-only access to your Google Drive files

    • View file metadata and organization

  5. Click Allow to grant access

  6. You'll be redirected back to Twig AI

Step 4: Select Folder or Files

After authentication, you'll see your Google Drive structure:

Option 1: Select Entire Drive

  • Import all accessible files in your Drive

  • Good for comprehensive knowledge bases

  • Use with caution for large Drives

Option 2: Select Specific Folders

  • Choose one or more folders to sync

  • Recommended for targeted knowledge areas

  • Better performance and organization

Option 3: Select Shared Drives (Team Drives)

  • Access shared/team drives

  • Ideal for team-wide knowledge bases

  • Requires appropriate permissions

Step 5: Configure Sync Options

File Filters (JSON Parameters)

Available Parameters:

Parameter
Type
Description
Default

folderId

String

Specific folder ID to sync

Root

includeSharedDrives

Boolean

Include team/shared drives

true

fileTypes

Array

File types to include

All

recursive

Boolean

Include subfolders

true

includeShared

Boolean

Include files shared with you

true

maxFiles

Number

Maximum files to sync

1000

modifiedAfter

String

Only files modified after date

All

Step 6: Test Connection

  1. Click Test Config or Test Connection

  2. Twig will verify:

    • OAuth credentials are valid

    • Folder/drive is accessible

    • File permissions allow reading

  3. Wait for "Connection Successful" message

Step 7: Set Refresh Schedule

Choose how often to sync changes:

  • Never - Manual sync only

  • Daily - Sync new/updated files daily (recommended)

  • Weekly - Sync weekly

  • Monthly - Sync monthly

Recommendation: Daily refresh for actively updated documentation

Step 8: Save and Sync

  1. Click Save or Create

  2. Initial sync begins automatically

  3. Monitor progress in data sources list

  4. Check process logs for any errors

Finding Google Drive Folder IDs

To sync a specific folder, you need its Folder ID.

Method 1: From URL

  1. Open the folder in Google Drive

  2. Look at the URL in your browser:

  3. Copy the ID (everything after /folders/)

Method 2: From Folder Details

  1. Right-click the folder in Google Drive

  2. Select "Get link" or "Share"

  3. Copy the link

  4. Extract the ID from the URL

Configuration Examples

Example 1: Team Documentation Folder

Example 2: Shared Team Drive

Example 3: Specific File Types

Best Practices

1. Use Service Accounts (Enterprise)

For enterprise deployments:

  • Create a dedicated Google Workspace service account

  • Grant read-only access to relevant folders

  • Use consistent authentication across team

  • Easier to manage and audit

2. Organize with Folders

Structure your Google Drive for easy syncing:

Sync each folder as a separate data source in Twig.

3. Use Appropriate File Types

Best for AI:

  • Google Docs (clean, structured text)

  • Google Sheets (structured data)

  • PDF (formatted documents)

  • Text files (simple content)

Less Optimal:

  • Images (unless text is clearly readable)

  • Zip files (extract first)

  • Compressed formats

4. Keep Folder Structure Flat

Good:

Avoid:

5. Set Appropriate Permissions

Ensure the authenticated account has:

  • Viewer or Editor access to folders

  • Access to shared files

  • Appropriate shared drive permissions

6. Limit Scope for Performance

Rather than syncing entire Drive:

7. Monitor File Count

Large numbers of files can:

  • Slow down syncs

  • Impact processing time

  • Increase storage usage

Split large folders into multiple data sources.

Understanding Sync Behavior

Initial Sync

  • Imports all files in selected scope

  • May take time for large folders

  • Processes files in batches

Incremental Syncs

  • Detects files modified since last sync

  • Imports only new/changed files

  • Much faster than initial sync

What Gets Synced

  • ✅ New files added to folder

  • ✅ Modified file content

  • ✅ Renamed files (as new files)

  • ✅ Moved files into synced folder

  • ❌ Files moved out of folder (remain until manual cleanup)

  • ❌ Deleted files (remain until manual cleanup)

  • ❌ Private files (no access)

  • ❌ Files in trash

File Conversion

Google Workspace files are automatically converted:

  • Google Docs → Plain text/HTML

  • Google Sheets → CSV data

  • Google Slides → Text from slides

  • Google Forms → Form structure and questions

Permissions & Security

OAuth Scopes Required

Twig requests these permissions:

  • drive.readonly - Read-only access to files

  • drive.metadata.readonly - File metadata and organization

Twig cannot:

  • Modify your files

  • Delete your files

  • Share your files

  • Create new files

Data Privacy

  • Files are processed and indexed securely

  • Original files remain in your Google Drive

  • Connection tokens are encrypted

  • You can revoke access anytime

Revoking Access

To disconnect Google Drive:

  1. In Twig: Delete the data source

  2. Find "Twig AI" and click Remove Access

Troubleshooting

Authentication Failed

Problem: Can't connect Google Drive

Solutions:

  • Ensure you're using correct Google account

  • Check if admin has blocked third-party apps

  • Try signing out and back into Google

  • Clear browser cookies and try again

  • Check if Google Drive API is enabled for workspace

No Files Found

Problem: Sync completes but no files imported

Solutions:

  • Verify folder ID is correct

  • Check authenticated account has access to folder

  • Ensure folder contains supported file types

  • Review file type filters in parameters

  • Check maxFiles limit isn't too restrictive

Permission Denied Errors

Problem: Some files fail to sync

Solutions:

  • Verify account has access to all files

  • Check if files are in trash

  • Ensure shared drive access if applicable

  • Review file-level permissions

  • Look for files in "Shared with me" needing explicit access

Slow Syncs

Problem: Syncs take very long time

Solutions:

  • Reduce maxFiles limit

  • Disable recursive if not needed

  • Filter by specific fileTypes

  • Split large folders into multiple sources

  • Check Google Drive API quota

Missing Recent Changes

Problem: Recent file updates not appearing

Solutions:

  • Check last sync date

  • Manually trigger refresh

  • Verify refresh schedule is appropriate

  • Look for sync errors in process logs

  • Check if file modification date updated in Drive

Shared Drive Issues

Problem: Can't access shared/team drives

Solutions:

  • Ensure account is member of shared drive

  • Verify includeSharedDrives: true in parameters

  • Check shared drive permissions

  • Confirm shared drive hasn't been deleted

  • Try re-authenticating

Advanced Configuration

Syncing Multiple Folders

Create separate data sources for each folder:

Date-Based Filtering

Import only recent files:

Excluding Specific Files

While not directly supported, you can:

  1. Move excluded files to a different folder

  2. Use specific folder IDs to include only desired content

  3. Filter by file type to exclude unwanted formats

Monitoring & Maintenance

Regular Checks

Weekly:

  • Verify last sync completed

  • Check file count trends

  • Review process logs

Monthly:

  • Audit synced folders

  • Remove outdated sources

  • Update folder selections

Metrics to Track

  • Files Synced: Total number of files

  • Last Sync Date: When was last successful sync

  • Sync Duration: Time taken for sync

  • Error Count: Failed file imports

  • Storage Used: Data indexed from Drive

Integration Best Practices

1. Create AI Agents per Team

2. Use Tags for Organization

Tag data sources by:

  • Department: "engineering", "product", "marketing"

  • Content type: "docs", "specs", "presentations"

  • Access level: "internal", "public", "confidential"

3. Combine with Other Sources

Create comprehensive knowledge bases:

  • Google Drive: Living documents

  • Confluence: Structured wikis

  • Slack: Team discussions

  • Files: Legacy documents

Next Steps

After connecting Google Drive:

  1. Test the knowledge with document-based questions

  2. Optimize folder structure based on usage

  3. Expand to additional folders as needed

Support

For Google Drive API issues:

  • Google Drive API Documentation: https://developers.google.com/drive

  • Google Workspace Admin Console: https://admin.google.com

  • Check API quotas and limits

For Twig integration issues:

  • Review process logs in Twig

  • Contact Twig support with specific file IDs

  • Share folder structure if troubleshooting access issues

Last updated