Skip to content

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.

Everything starts with Google Drive — Connect, which supports two modes in authType:

ModeWhat you needWhen 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-accountA 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.

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.

Upload, List files, Get info, Create folder, Copy, Move and Rename return each file or folder as a Dictionary with these keys:

KeyTypeContent
idstringFile or folder ID.
namestringName, with its extension if it has one.
mimeTypestringContent type, e.g. application/pdf. Folders are application/vnd.google-apps.folder and native Google documents start with application/vnd.google-apps.
isFolderbooltrue for a folder.
sizelongSize in bytes. Null for folders and native Google documents (Docs, Sheets, Slides).
parentsListIDs of the folders that contain it. May be null for items shared with you that are not in your drive.
modifiedTimestringLast modified, ISO 8601 with offset (e.g. 2026-06-15T14:30:00.0000000+00:00).
createdTimestringCreation date, same format.
webViewLinkstringLink to open it in the browser.
trashedbooltrue if it is in the trash.
ActivityTypeOutputDescription
Google Drive — Connectgoogledrive-connectZoanGoogleDriveSessionOpens an authenticated Google Drive session
Google Drive — Uploadgoogledrive-uploadDictionary<string,object>Uploads a local file to Google Drive
Google Drive — Downloadgoogledrive-downloadstringDownloads a file from Google Drive
Google Drive — List filesgoogledrive-listList<Dictionary<string,object>>Lists or searches files and folders
Google Drive — Get infogoogledrive-get-infoDictionary<string,object>Gets the metadata of a file or folder by its ID
Google Drive — Create foldergoogledrive-create-folderDictionary<string,object>Creates a folder in Google Drive
Google Drive — Copygoogledrive-copyDictionary<string,object>Copies a file in Google Drive
Google Drive — Movegoogledrive-moveDictionary<string,object>Moves a file or folder to another folder
Google Drive — Renamegoogledrive-renameDictionary<string,object>Renames a file or folder
Google Drive — Sharegoogledrive-shareDictionary<string,object>Shares a file or folder by granting a permission
Google Drive — Deletegoogledrive-delete—Moves a file or folder to the trash (or deletes it permanently)
Google Drive — Closegoogledrive-close—Closes a Google Drive session

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:

CodeUsual causeWhat 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.
ForbiddenThe 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.
BadRequestA rejected parameter, for example a query with invalid syntax.Review the query against the Drive search syntax.
UnauthorizedThe token is no longer valid (access revoked, connection expired).Reconnect the connection in Zoan Cloud.
TooManyRequestsGoogle’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.