Google Drive Activities
Google Drive Activities
Section titled “Google Drive Activities”Version: 1.0.5 · ID: zoan-packages-googledrive · Author: Zoan Software
The Google Drive package uploads, downloads, searches and organizes Drive files and folders directly through its API, without opening a browser: file the reports the robot produces, collect the documents a team drops into a folder, or share a deliverable with a customer.
Authentication
Section titled “Authentication”Everything starts with Google Drive — Connect, which supports two modes in authType:
| Mode | What you need | When it fits |
|---|---|---|
oauth (default) | A Zoan Cloud Google OAuth connection authorized with the Drive permission (https://www.googleapis.com/auth/drive). Pass it in credential as credential("code-name"); Zoan Cloud refreshes the token for you. | The robot works with the Drive of a person or a team account. |
service-account | A service account key (full JSON) stored as a credential, in serviceAccount. Without impersonateUser, the service account only sees what has been shared with its email; with impersonateUser (domain-wide delegation) it works in that Workspace user’s Drive. | Unattended runs with no person’s consent. |
Place the other activities inside Connect’s body so they inherit the session (ZoanGoogleDriveSession) and it closes by itself at the end.
Everything is identified by ID
Section titled “Everything is identified by ID”Drive does not work with paths: every file and folder has an ID (the last part of its URL, drive.google.com/drive/folders/{ID}). Get IDs with List files, Create folder or Upload, and pass them to the other activities. root is the alias for the root of My Drive.
The activities work with My Drive and with what is shared with you. Items in shared drives are out of their reach.
File metadata
Section titled “File metadata”Upload, List files, Get info, Create folder, Copy, Move and Rename return each file or folder as a Dictionary with these keys:
| Key | Type | Content |
|---|---|---|
id | string | File or folder ID. |
name | string | Name, with its extension if it has one. |
mimeType | string | Content type, e.g. application/pdf. Folders are application/vnd.google-apps.folder and native Google documents start with application/vnd.google-apps. |
isFolder | bool | true for a folder. |
size | long | Size in bytes. Null for folders and native Google documents (Docs, Sheets, Slides). |
parents | List | IDs of the folders that contain it. May be null for items shared with you that are not in your drive. |
modifiedTime | string | Last modified, ISO 8601 with offset (e.g. 2026-06-15T14:30:00.0000000+00:00). |
createdTime | string | Creation date, same format. |
webViewLink | string | Link to open it in the browser. |
trashed | bool | true if it is in the trash. |
Activities
Section titled “Activities”| Activity | Type | Output | Description |
|---|---|---|---|
| Google Drive — Connect | googledrive-connect | ZoanGoogleDriveSession | Opens an authenticated Google Drive session |
| Google Drive — Upload | googledrive-upload | Dictionary<string,object> | Uploads a local file to Google Drive |
| Google Drive — Download | googledrive-download | string | Downloads a file from Google Drive |
| Google Drive — List files | googledrive-list | List<Dictionary<string,object>> | Lists or searches files and folders |
| Google Drive — Get info | googledrive-get-info | Dictionary<string,object> | Gets the metadata of a file or folder by its ID |
| Google Drive — Create folder | googledrive-create-folder | Dictionary<string,object> | Creates a folder in Google Drive |
| Google Drive — Copy | googledrive-copy | Dictionary<string,object> | Copies a file in Google Drive |
| Google Drive — Move | googledrive-move | Dictionary<string,object> | Moves a file or folder to another folder |
| Google Drive — Rename | googledrive-rename | Dictionary<string,object> | Renames a file or folder |
| Google Drive — Share | googledrive-share | Dictionary<string,object> | Shares a file or folder by granting a permission |
| Google Drive — Delete | googledrive-delete | — | Moves a file or folder to the trash (or deletes it permanently) |
| Google Drive — Close | googledrive-close | — | Closes a Google Drive session |
Google API errors
Section titled “Google API errors”When Google rejects a call, the activity fails with a GoogleApiException whose message starts with The service drive has thrown an exception. HttpStatusCode is … followed by Google’s text:
| Code | Usual cause | What to do |
|---|---|---|
NotFound (File not found: …) | The ID does not exist, is in a shared drive, or the account has no access to it. | Check the ID with List files from the same account. |
Forbidden | The account only has view or comment access to the item, the connection lacks the Drive permission, or a quota was exceeded. | Ask for edit access to the item or re-authorize the connection with the Drive permission. |
BadRequest | A rejected parameter, for example a query with invalid syntax. | Review the query against the Drive search syntax. |
Unauthorized | The token is no longer valid (access revoked, connection expired). | Reconnect the connection in Zoan Cloud. |
TooManyRequests | Google’s per-minute request quota was exceeded. | Wrap the activity in Retry with a delay. |
Catch any of them with Try / Catch; error.Type is GoogleApiException.