Google Drive Tools
Author: yoshiki-0428
Version: 0.0.1
Type: tool
Description
This plugin provides a set of tools for integrating Google Drive with Dify applications. It allows you to search, create, and manage files and folders in Google Drive directly from your Dify workflows and agents.
Tools Included
- File Search - Search for files in Google Drive by name
- Folder Search - Find folders in Google Drive by name
- Create File - Upload files to Google Drive
- Create Folder - Create new folders in Google Drive
- File Download - Download files from Google Drive (Google Workspace files are automatically exported to PDF before download)
Setup
Prerequisites
- A Google Cloud Platform account
- A Google Cloud project with the Google Drive API enabled
- A service account with appropriate permissions for Google Drive
Creating a Service Account
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Drive API for your project
- Create a service account:
- Go to "IAM & Admin" > "Service Accounts"
- Click "Create Service Account"
- Give it a name and description
- Grant it appropriate roles (at least "Drive File Creator" and "Drive Viewer")
- Click "Create"
- Create a key for the service account:
- Click on the service account you just created
- Go to the "Keys" tab
- Click "Add Key" > "Create new key"
- Choose JSON format and click "Create"
- Save the downloaded JSON file securely
Configuration in Dify
- In your Dify application, go to the Plugins section
- Find and install the Google Drive plugin
- When configuring the plugin, you'll need to provide:
- credentials_json: The entire content of the service account JSON key file
Usage Examples
Search for Files
Use the File Search tool to find files in Google Drive by name:
Create a Folder
Use the Create Folder tool to create a new folder in Google Drive:
Upload a File
Use the Create File tool to upload a file to Google Drive:
Download a File
Use the File Download tool to download a file by its ID. Google Workspace documents (Docs, Sheets, Slides, etc.) are exported to PDF automatically.
Permissions and Security
- The tools operate with the permissions of the service account you configured
- To access user-specific files, you'll need to share those files with the service account email
- For shared drives, the service account needs to be added as a member of the shared drive
Troubleshooting
If you encounter issues:
- Verify that the Google Drive API is enabled in your Google Cloud project
- Check that the service account has the necessary permissions
- Ensure the credentials JSON is correctly formatted and complete
- For "File not found" errors, verify that the file exists and is accessible to the service account
Support
For issues or feature requests, please open an issue in the Dify Official Plugins repository.