Product
Google Drive
Sync Google Drive folders and files to Twig
TL;DR
Sync Google Drive folders and files to Twig. | Property | Value | | --------------------- | ------------------------------------------------------- | | Type | Dynamic (OAuth 2.0) ...
Key Takeaways
- Overview
- Use Cases
- Supported File Types
- Setup Steps
- Finding Google Drive Folder IDs
- Configuration Examples
Sync Google Drive folders and files to Twig.
Overview
| Property | Value |
|---|---|
| Type | Dynamic (OAuth 2.0) |
| Sync Schedule | Hourly, Daily, Weekly, Manual |
| Plan Availability | All plans |
| Supported Files | Google Docs, Sheets, Slides, PDF, DOCX, TXT, XLSX, PPTX |
| Max Files | 1,000 per data source (configurable) |
Use Cases
- Collaborative docs: Google Docs with multiple editors
- Team drives: Shared drives with department content
- Live documentation: Frequently updated content
- Workspace-native orgs: Companies using Google Workspace exclusively
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
Setup Steps
1. Add Data Source
- Twig → Data → Add Data Source → Google Drive
- Fill:
- Name: e.g., "Product Docs Folder"
- Description: Optional
- Tags: Optional
2. Authenticate
- Click Connect Google Drive button
- Redirected to Google OAuth screen
- Select Google account
- Review permissions:
- Read-only access to Drive files
- View file metadata
- Click Allow
- Redirected back to Twig
OAuth scopes requested:
drive.readonlydrive.metadata.readonly
Twig cannot: Modify, delete, or share your files
3. Select Scope
Option A: Entire Drive (not recommended)
- Imports all accessible files
- Can exceed file limits
- Slow processing
Option B: Specific Folder (recommended)
- Click Select Folder button
- Navigate to target folder
- Click Select
Option C: Shared Drive
- Toggle Include Shared Drives
- Select shared drive from list
- Optionally select folder within shared drive
Finding Folder ID:
- Open folder in browser
- Copy ID from URL:
https://drive.google.com/drive/folders/1a2B3c4D5e6F7g8H9i0J - ID is the alphanumeric string after
/folders/
Step 5: Configure Sync Options
File Filters (JSON Parameters)
{
"folderId": "abc123xyz",
"includeSharedDrives": true,
"fileTypes": ["doc", "sheet", "pdf"],
"recursive": true,
"includeShared": true,
"maxFiles": 500
}
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
- Click Test Config or Test Connection
- Twig will verify:
- OAuth credentials are valid
- Folder/drive is accessible
- File permissions allow reading
- 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
- Click Save or Create
- Initial sync begins automatically
- Monitor progress in data sources list
- 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
-
Open the folder in Google Drive
-
Look at the URL in your browser:
https://drive.google.com/drive/folders/1a2B3c4D5e6F7g8H9i0J ^^^^^^^^^^^^^^^^^^^^ This is the Folder ID -
Copy the ID (everything after
/folders/)
Method 2: From Folder Details
- Right-click the folder in Google Drive
- Select "Get link" or "Share"
- Copy the link
- Extract the ID from the URL
Configuration Examples
Example 1: Team Documentation Folder
Name: Engineering Documentation
Description: Technical docs and specifications
Authentication: OAuth (john@example.com)
Parameters:
{
"folderId": "1a2B3c4D5e6F7g8H9i0J",
"recursive": true,
"fileTypes": ["doc", "sheet", "pdf"],
"includeShared": true
}
Refresh: Daily
Tags: engineering, docs, internal
Example 2: Shared Team Drive
Name: Product Team Drive
Description: Complete product team shared drive
Authentication: OAuth (team@example.com)
Parameters:
{
"includeSharedDrives": true,
"recursive": true,
"maxFiles": 500
}
Refresh: Daily
Tags: product, team-drive, shared
Example 3: Specific File Types
Name: Product Specifications
Description: Product spec documents only
Authentication: OAuth (pm@example.com)
Parameters:
{
"folderId": "xyz789abc",
"fileTypes": ["doc"],
"recursive": false,
"includeShared": false
}
Refresh: Weekly
Tags: product, specs, documents
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:
📁 Company Knowledge Base/
📁 Product Documentation/
📁 Support Articles/
📁 Training Materials/
📁 Technical Specs/
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:
📁 Documentation/
📄 Getting Started.gdoc
📄 API Reference.gdoc
📄 Tutorials.gdoc
Avoid:
📁 Documentation/
📁 Section A/
📁 Subsection 1/
📁 Sub-subsection a/
📄 Document.gdoc (too deep)
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:
{
"folderId": "specific-folder-id",
"recursive": true,
"maxFiles": 500
}
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 filesdrive.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:
- In Twig: Delete the data source
- In Google: Visit Google Account Permissions
- 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
maxFileslimit 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
maxFileslimit - Disable
recursiveif 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: truein 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:
// Source 1: Engineering Docs
{
"folderId": "abc123",
"fileTypes": ["doc", "pdf"]
}
// Source 2: Product Specs
{
"folderId": "xyz789",
"fileTypes": ["doc", "sheet"]
}
Date-Based Filtering
Import only recent files:
{
"modifiedAfter": "2024-01-01",
"maxFiles": 200
}
Excluding Specific Files
While not directly supported, you can:
- Move excluded files to a different folder
- Use specific folder IDs to include only desired content
- 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
Agent: Engineering Assistant
Data Sources: Engineering Docs folder
Agent: Product Assistant
Data Sources: Product Specs folder
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:
- Test the knowledge with document-based questions
- Create team-specific agents
- Monitor which documents are most referenced
- Optimize folder structure based on usage
- Expand to additional folders as needed
Related Connectors
- Microsoft OneDrive - Microsoft cloud storage
- Microsoft SharePoint - SharePoint sites
- Confluence - Wiki-based knowledge
- Files - Direct file uploads
- Slack - Team discussions
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
Agent Instructions: Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.
Perform an HTTP GET request on the current page URL with the ask query parameter:
GET /dev/product/data-integrations/google-drive.md?ask=<question>
The question should be specific, self-contained, and written in natural language. The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.
Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
Related Pages
Last updated January 26, 2026


