Google Drive
Overview
The Google Drive connector enables your AI Colleagues to integrate with your organization's Google Drive platform, facilitating automated file management, uploads, search, and permission workflows.
Google Drive is Google's cloud-based file storage and synchronization service that allows users to store files, share documents, and collaborate across teams. The Google Drive connector allows Leena AI to automate file management workflows, upload documents, search for files, and manage sharing permissions seamlessly.
API Details
Leena AI integrates with Google Drive via REST APIs.
Documentation link: https://developers.google.com/drive/api/guides/about-sdk
Setup
The Google Drive connector uses Service Account authentication for server-to-server interactions.
Prerequisites
Before setting up the Google Drive connector, ensure you have:
- Administrator access to your Google Cloud Console
- Access to Google Cloud Console IAM & Admin
- Ability to create Service Accounts in Google Cloud
- Access to your Leena AI workspace with connector management permissions
- Domain-wide delegation configured (if accessing user data across your organization)
Get credentials
Here is how to create a Service Account in Google Cloud Console:
- Log in to Google Cloud Console (Ensure you're signed in as an admin).
- Navigate to IAM & Admin:
- Click on the hamburger menu at the top left corner
- Hover on IAM & Admin
- Click on Service Accounts
- Enable Google Drive API:
- Go to APIs & Services > Library
- Search for "Google Drive API"
- Click Enable
- Create Service Account:
- Navigate back to IAM & Admin > Service Accounts
- Click + CREATE SERVICE ACCOUNT
- Enter a Service account name and ID
- Click Create and continue
- Configure Service Account Roles:
- Role: Select appropriate roles for your use case (e.g., Viewer, Editor)
- Click Continue
- Click Done
- Generate Service Account Key:
- Click on the newly created service account email
- Go to the Keys tab
- Click Add Key > Create new key
- Select JSON as the key type
- Click Create
- The JSON key file will be downloaded automatically - store it securely
- Configure Domain-Wide Delegation (Optional - for accessing user data):
- Go to Google Workspace Admin Console
- Navigate to Security > Access and data control > API Controls
- Click Manage Domain Wide Delegation
- Click Add new
- Enter the service account's Client ID (found in the JSON file)
- Add required OAuth scopes:
https://www.googleapis.com/auth/drive - Click Authorize
Add connection
Here is how to add a connection on Leena AI:
- Log in to your Leena AI workspace
- Navigate to Settings > Integrations
- Search for "Google Drive" and select it from the list to add its new connector
- Start configuring the connector
- Auth Type: Select "Service Account"
- Service Account Credentials: Upload the JSON key file downloaded from Google Cloud Console
- Admin Email: Email address for domain-wide delegation (if applicable)
- Complete Configuration and Save
- Click Connect in Leena AI for Google Drive connector setup
- The connector will validate the credentials
- Upon successful validation, the connector will be saved
- Share Files/Folders with Service Account (Important):
- Copy the service account email from your JSON credentials file
- Go to Google Drive and navigate to the files or folders you want to access
- Right-click on the file/folder and select Share
- Paste the service account email and grant appropriate permissions (Viewer or Editor)
Actions
The following actions are supported for the Google Drive connector:
Upload File(s)
Uploads one or more files to a specified folder in Google Drive. The Agent can leverage the skill (workflow), which has been designed to upload files to Google Drive, once the user initiates a file upload request. Here are some common use cases:
- Document Archival: Upload generated reports or documents to Drive
- Content Intake: Consolidate files from various systems into Google Drive
- Backup Workflows: Automatically backup files to cloud storage
- File Distribution: Upload files for team access and collaboration
Input Parameters
Here are the input parameters required to set up this action:
Mandatory
| Name | Description |
|---|---|
| Select Drive | The drive location where files will be uploaded. Options: My Drive, Shared Drives, Shared with Me |
| Select Folder | The destination folder for the uploaded files |
| File(s) | Array of files to upload, each containing file format, input, and name |
File(s) Array Parameters
| Name | Description |
|---|---|
| Select file input type | The format of the input file data. Options: S3 URL, Base64 |
| Input file | The file content - either a URL (e.g., pre-signed S3 link) or Base64-encoded data |
| File Name (with extension) | The name to save the file as, including file extension (e.g., report.pdf) |
Conditional
| Name | Description |
|---|---|
| Select Shared Drive | Required when Select Drive is set to "Shared Drives". The specific shared drive to upload to |
Here is a sample JSON input:
// Upload single file from URL
{
"driveType": "MY_DRIVE",
"folderId": "1abc123xyz789",
"files": [
{
"fileFormat": "S3_URL",
"fileInput": "https://example-bucket.s3.amazonaws.com/reports/quarterly-report.pdf",
"fileName": "Q3-Report-2025.pdf"
}
]
}
// Upload multiple files with Base64
{
"driveType": "SHARED_DRIVES",
"sharedDriveId": "0ABcDefGhIjKlMn",
"folderId": "1xyz789abc123",
"files": [
{
"fileFormat": "BASE64",
"fileInput": "JVBERi0xLjQKJeLjz9MKNCAwIG9iago8PC...",
"fileName": "invoice-001.pdf"
},
{
"fileFormat": "S3_URL",
"fileInput": "https://bucket.s3.amazonaws.com/attachments/image.png",
"fileName": "product-image.png"
}
]
}
// Upload to Shared with Me folder
{
"driveType": "SHARED_WITH_ME",
"folderId": "1shared-folder-id",
"files": [
{
"fileFormat": "S3_URL",
"fileInput": "https://storage.example.com/documents/contract.docx",
"fileName": "signed-contract.docx"
}
]
}Response
Upon successful upload, the action returns the uploaded file details including:
- File ID
- File Name
- MIME Type
- File Kind
Fetch Files
Searches and retrieves files from Google Drive based on specified criteria. The Agent can leverage the skill (workflow), which has been designed to search for files in Google Drive, once the user requests to find specific documents. Here are some common use cases:
- Document Search: Find files by name across Drive locations
- File Retrieval: Locate specific documents for downstream workflows
- Content Discovery: Search for files matching partial names
- Folder Exploration: Find files within specific folders
Input Parameters
Here are the input parameters required to set up this action:
Mandatory
| Name | Description |
|---|---|
| Select Drive | The drive location to search. Options: My Drive, Shared Drives, Shared with Me |
| File Name with extension | The name of the file to search for (with file extension) |
Optional
| Name | Description |
|---|---|
| Select Folder | Narrow the search to a specific folder |
| Exact Match? | Toggle to search for exact file name match (true) or partial match (false). Default: true |
Conditional
| Name | Description |
|---|---|
| Select Shared Drive | Required when Select Drive is set to "Shared Drives". The specific shared drive to search in |
Here is a sample JSON input:
// Exact match search in My Drive
{
"driveType": "MY_DRIVE",
"fileName": "quarterly-report.pdf",
"isExactMatch": true
}
// Partial match search in Shared Drives
{
"driveType": "SHARED_DRIVES",
"sharedDriveId": "0ABcDefGhIjKlMn",
"fileName": "report",
"isExactMatch": false
}
// Search in specific folder
{
"driveType": "MY_DRIVE",
"folderId": "1abc123xyz789",
"fileName": "invoice",
"isExactMatch": false
}
// Search in Shared with Me
{
"driveType": "SHARED_WITH_ME",
"fileName": "project-plan.xlsx",
"isExactMatch": true
}Response
The action returns a list of matching files, each containing:
- Name
- URL (webViewLink to open the file in Google Drive)
Update sharing preference
Updates the sharing settings and permissions for files or folders in Google Drive. The Agent can leverage the skill (workflow), which has been designed to modify access permissions, once the user requests to share or update permissions on a file. Here are some common use cases:
- Share Documents: Grant access to specific users or groups
- Public Sharing: Make files accessible via link
- Organization Sharing: Restrict access to domain users only
- Permission Updates: Modify existing access levels
- Access Revocation: Change or remove user permissions
Input Parameters
Here are the input parameters required to set up this action:
Mandatory
| Name | Description |
|---|---|
| Select Drive | The drive location containing the file/folder. Options: My Drive, Shared Drives, Shared with Me |
| File/Folder (URL) | The URL of the file or folder to update permissions for. Can be selected from a list or entered dynamically |
| Sharing Preference | The type of sharing to apply. Options: Anyone at your organization, Anyone on the internet, Specific User |
Conditional Parameters
Based on Sharing Preference selection:
When "Anyone at your organization" is selected:
| Name | Description |
|---|---|
| Anyone at your organization | The role to assign. Options: Can view, Can edit, Can comment |
| Domain | The Google Workspace domain to restrict access to |
When "Anyone on the internet" is selected:
| Name | Description |
|---|---|
| Anyone on the internet | The role to assign. Options: Can view, Can edit, Can comment |
When "Specific User" is selected:
| Name | Description |
|---|---|
| Specific User | The role to assign. Options: Can view, Can edit, Can comment |
| User Email | Email addresses of users to grant access to. Can be selected from a list or entered dynamically |
Additional Options
| Name | Description |
|---|---|
| Files/Folders Dynamic? | Toggle to enable dynamic input for file/folder URL (for automated workflows) |
| Users Dynamic? | Toggle to enable dynamic input for user emails (for automated workflows) |
| Select Shared Drive | Required when Select Drive is set to "Shared Drives". The specific shared drive containing the file |
Here is a sample JSON input:
// Share with anyone on the internet (View only)
{
"driveType": "MY_DRIVE",
"fileUrl": "https://drive.google.com/file/d/1abc123xyz789/view",
"permissionType": "anyone",
"anyoneRole": "reader"
}
// Share with organization domain (Edit access)
{
"driveType": "MY_DRIVE",
"fileUrl": "https://drive.google.com/file/d/1abc123xyz789/view",
"permissionType": "domain",
"domainRole": "writer",
"domain": "company.com"
}
// Share with specific users (Comment access)
{
"driveType": "SHARED_DRIVES",
"sharedDriveId": "0ABcDefGhIjKlMn",
"fileUrl": "https://drive.google.com/file/d/1xyz789abc123/view",
"permissionType": "user",
"userRole": "commenter",
"userEmails": ["[email protected]", "[email protected]"]
}
// Share from Shared with Me location
{
"driveType": "SHARED_WITH_ME",
"fileUrl": "https://drive.google.com/file/d/1shared-file-id/view",
"permissionType": "user",
"userRole": "reader",
"userEmails": ["[email protected]"]
}Response
Upon successful permission update, the action returns the permission details including:
- Permission ID
- Permission Type
- Role
- Email Address (for user permissions)
- Domain (for domain permissions)
Updated 1 day ago
