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:

  1. Log in to Google Cloud Console (Ensure you're signed in as an admin).
  2. Navigate to IAM & Admin:
    1. Click on the hamburger menu at the top left corner
    2. Hover on IAM & Admin
    3. Click on Service Accounts
  3. Enable Google Drive API:
    1. Go to APIs & Services > Library
    2. Search for "Google Drive API"
    3. Click Enable
  4. Create Service Account:
    1. Navigate back to IAM & Admin > Service Accounts
    2. Click + CREATE SERVICE ACCOUNT
    3. Enter a Service account name and ID
    4. Click Create and continue
  5. Configure Service Account Roles:
    1. Role: Select appropriate roles for your use case (e.g., Viewer, Editor)
    2. Click Continue
    3. Click Done
  6. Generate Service Account Key:
    1. Click on the newly created service account email
    2. Go to the Keys tab
    3. Click Add Key > Create new key
    4. Select JSON as the key type
    5. Click Create
    6. The JSON key file will be downloaded automatically - store it securely
  7. Configure Domain-Wide Delegation (Optional - for accessing user data):
    1. Go to Google Workspace Admin Console
    2. Navigate to Security > Access and data control > API Controls
    3. Click Manage Domain Wide Delegation
    4. Click Add new
    5. Enter the service account's Client ID (found in the JSON file)
    6. Add required OAuth scopes: https://www.googleapis.com/auth/drive
    7. Click Authorize

Add connection

Here is how to add a connection on Leena AI:

  1. Log in to your Leena AI workspace
  2. Navigate to Settings > Integrations
  3. Search for "Google Drive" and select it from the list to add its new connector
  4. Start configuring the connector
    1. Auth Type: Select "Service Account"
    2. Service Account Credentials: Upload the JSON key file downloaded from Google Cloud Console
    3. Admin Email: Email address for domain-wide delegation (if applicable)
  5. Complete Configuration and Save
    1. Click Connect in Leena AI for Google Drive connector setup
    2. The connector will validate the credentials
    3. Upon successful validation, the connector will be saved
  6. Share Files/Folders with Service Account (Important):
    1. Copy the service account email from your JSON credentials file
    2. Go to Google Drive and navigate to the files or folders you want to access
    3. Right-click on the file/folder and select Share
    4. 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

NameDescription
Select DriveThe drive location where files will be uploaded. Options: My Drive, Shared Drives, Shared with Me
Select FolderThe destination folder for the uploaded files
File(s)Array of files to upload, each containing file format, input, and name

File(s) Array Parameters

NameDescription
Select file input typeThe format of the input file data. Options: S3 URL, Base64
Input fileThe 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

NameDescription
Select Shared DriveRequired 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

NameDescription
Select DriveThe drive location to search. Options: My Drive, Shared Drives, Shared with Me
File Name with extensionThe name of the file to search for (with file extension)

Optional

NameDescription
Select FolderNarrow the search to a specific folder
Exact Match?Toggle to search for exact file name match (true) or partial match (false). Default: true

Conditional

NameDescription
Select Shared DriveRequired 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

NameDescription
Select DriveThe 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 PreferenceThe 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:

NameDescription
Anyone at your organizationThe role to assign. Options: Can view, Can edit, Can comment
DomainThe Google Workspace domain to restrict access to

When "Anyone on the internet" is selected:

NameDescription
Anyone on the internetThe role to assign. Options: Can view, Can edit, Can comment

When "Specific User" is selected:

NameDescription
Specific UserThe role to assign. Options: Can view, Can edit, Can comment
User EmailEmail addresses of users to grant access to. Can be selected from a list or entered dynamically

Additional Options

NameDescription
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 DriveRequired 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)