Google Drive
Search (escaped queries) and list files, export and download to a directory, upload, folders, copy, rename/move, shared drives, sharing, trash and delete are node only (OAuth or service account)
Beta v0.1.0 Node.js 17 actions
About
A Graphrt plugin for the Google Drive API v3: list and search files, read metadata, export Google files and download stored files into a directory, upload, create folders, copy (e.g. templates), rename and move, read sharing, and (node only) share, trash and delete. Shared drives are included.
What it can do
- Find: search_files (name words, content words, type, folder, modified after an RFC 3339 date-time, trashed files excluded), list_files (raw q), get_file, get_about, list_drives
- Content: export_file (Google Docs/Sheets/Slides to PDF, DOCX, CSV, ..., Drive caps exports at 10 MB), download_file (stored files, up to 200 MB), both saved into $GOOGLE_DRIVE_DOWNLOAD_DIR and returning {path, bytes, content_type}
- Write: upload_file (up to 5 MB, optional conversion to a Google file), create_folder, copy_file, update_file (rename, describe, star, move with add/remove parents)
- Sharing: list_permissions, share_file and remove_permission (node only)
- Remove: trash_file and delete_file (node only)
- api_request: any other endpoint (GET only for agents)
Actions
Each action is a step you can add to a workflow. Agents can also use most of them as tools.
- Account and quota
google-drive.get_about - List files
google-drive.list_files - Search files
google-drive.search_files - Get file
google-drive.get_file - Export Google file
google-drive.export_file - Download file
google-drive.download_file - List sharing
google-drive.list_permissions - Shared drives
google-drive.list_drives - Create folder
google-drive.create_folder - Copy file
google-drive.copy_file
Show all 17 actions
- Rename or move
google-drive.update_file - Share file
google-drive.share_file - Unshare
google-drive.remove_permission - Trash file
google-drive.trash_file - Delete file
google-drive.delete_file - Upload file
google-drive.upload_file - Google Drive API request
google-drive.api_request
Settings
Graphrt starts plugins with a clean environment. Only these values reach the plugin, and secrets stay out of logs.
-
GOOGLE_REFRESH_TOKENOAuth refresh trio -
GOOGLE_SERVICE_ACCOUNT_JSONPath to a service account key file (scope drive), it sees only files shared with its email (and its own Drive) -
GOOGLE_ACCESS_TOKENA ready access token (used only when neither of the above is set) -
GOOGLE_DRIVE_DOWNLOAD_DIRAbsolute directory for export_file and download_file -
GOOGLE_DRIVE_UPLOAD_DIRDirectory upload_file may read local files from (https URLs work without it) -
GOOGLE_DRIVE_TOOL_FOLDER_ALLOWLISTComma-separated folder ids agent tools may put files into (* = any folder) -
GOOGLE_CLIENT_ID -
GOOGLE_CLIENT_SECRET -
GOOGLE_DRIVE_TOOL_TOKEN_SOURCE
How to use it
In Graphrt Desktop
- Open Plugins and search for Google Drive.
- Click Install and approve it.
- Follow the setup steps on the plugin's page, then paste the settings it needs.
- Describe a job that needs it, and the builder adds the steps.
With the CLI
terminal
$ graphrt plugin install google-drive workflow.yaml
- id: template
type: google-drive.search_files
name_contains: Invoice template
mime_type: application/vnd.google-apps.document
- id: copy
type: google-drive.copy_file
file_id: "{{#template.data.0.id#}}"
name: "Invoice {{#start.number#}}"
parent_ids: ["{{#start.folder_id#}}"]
- id: pdf
type: google-drive.export_file
file_id: "{{#copy.data.id#}}"
mime_type: application/pdf # saved into $GOOGLE_DRIVE_DOWNLOAD_DIR