Google Drive

Upload files, create folders, and manage content in Google Drive.

ProductivityOAuth16 actionsAll integrations

On this page
  1. Connect
  2. Call it from a workflow
  3. Actions (16)
  4. list-files
  5. read-file
  6. search-folder
  7. create_new_gdrive_file
  8. create_new_gdrive_folder
  9. custom_api_call
  10. delete_gdrive_file
  11. delete_permissions
  12. duplicate_file
  13. get-file-or-folder-by-id
  14. google-drive-move-file
  15. save_file_as_pdf
  16. set_public_access
  17. trash_gdrive_file
  18. update_permissions
  19. upload_gdrive_file
  20. Details

Connect

Auth type: OAuth (oauth2). The connection holds the provider's OAuth tokens. They are sealed on the server and only opened when an action runs.

Scopes requested: https://www.googleapis.com/auth/drive

  • From your agent: integrations {action: "connect", piece, credentials, env} stores the credentials for dev, prod or all. Answers name the fields, never the values.
  • Or set the integration's project secrets with the secrets tool (SLACK_BOT_TOKEN, DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN, TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN …): a call uses the connection, else those secrets. integrations {action: "catalog", piece} lists which ones work.
  • Try one action now with integrations {action: "call", piece, piece_action, input}. It really sends.

Call it from a workflow

step.ctx.integrations.invoke("google_drive", action, input) resolves with the provider's answer and rejects when Google Drive isn't connected or refuses. Wrap it in step.run so a retry sends once. See step.ctx. Its actions run through the integration runner, which the server's operator turns on: integrations {action: "catalog", piece: "google_drive"} says whether yours can call it.

Workflow
// workflows/notify.ts: call Google Drive when a booking is confirmed
import { on } from "@appbricx/workflows";

export const tellGoogleDrive = on.transition("booking", "status", "confirmed", async (_event, step) => {
  // Recorded once: a retry doesn't send it twice. Rejects when Google Drive isn't connected.
  const output = await step.run("Google Drive", () =>
    step.ctx.integrations.invoke("google_drive", "list-files", {
      "folderId": "<folder id>"
    }),
  );
  step.ctx.log("Google Drive answered", output);
});
Try it from your agent
{
  "name": "integrations",
  "arguments": {
    "project_id": "<project-id>",
    "action": "call",
    "piece": "google_drive",
    "piece_action": "list-files",
    "input": {
      "folderId": "<folder id>"
    },
    "env": "dev"
  }
}
From another backend (connector proxy)
curl -X POST "$APP_ORIGIN/__appbricx/connector-proxy/google_drive/list-files" \
  -H "Authorization: Bearer $APP_KEY" \
  -H "content-type: application/json" \
  -d '{"props":{"folderId":"<folder id>"}}'

Actions

list-files

List files. List files from a Google Drive folder

Also accepted as list_files.

InputTypeDescription
folderIdrequiredtextFolder ID coming from | New Folder -> id | (or any other source)
include_team_drivesoptionalbooleanDetermines if folders from Team Drives should be included in the results.
includeTrashedoptionalbooleanInclude new files that have been trashed.
depthLeveloptionalnumberHow many levels deep to search for files. 1 = current folder only, 2 = current + next level, etc.
downloadFilesoptionalbooleanDownload all file contents in a list

read-file

Read File Content. Read a selected file from google drive file

InputTypeDescription
fileIdrequiredtextFile ID coming from | New File -> id |
fileNameoptionaltextDestination File name

search-folder

Search. Search a Google Drive folder for files/sub-folders

InputTypeDescription
queryTermrequiredone of "name" | "fullText" | "mimeType"The Query term or field of file/folder to search upon.
operatorrequiredone of "contains" | "="The operator to create criteria.
queryrequiredtextValue of the field of file/folder to search for.
typeoptionalone of "all" | "file" | "folder"(Optional) Choose between files and folders.
parentFolderoptionalid (picked from your account)Parent Folder
include_team_drivesoptionalbooleanDetermines if folders from Team Drives should be included in the results.

create_new_gdrive_file

Create new file. Create a new text file in your Google Drive from text

InputTypeDescription
fileNamerequiredtextThe name of the new text file
textrequiredlong textThe text content to add to file
fileTyperequiredone of "plain/text" | "text/csv" | "text/xml"Select file type
parentFolderoptionalid (picked from your account)Parent Folder
include_team_drivesoptionalbooleanDetermines if folders from Team Drives should be included in the results.

create_new_gdrive_folder

Create new folder. Create a new empty folder in your Google Drive

InputTypeDescription
folderNamerequiredtextThe name of the new folder
parentFolderoptionalid (picked from your account)Parent Folder
include_team_drivesoptionalbooleanDetermines if folders from Team Drives should be included in the results.

custom_api_call

Custom API Call. Make a custom API call to a specific endpoint

InputTypeDescription
urlrequiredobject (depends on other props)url
methodrequiredone of "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | "HEAD"Method
headersrequiredobjectAuthorization headers are injected automatically from your connection.
queryParamsrequiredobjectQuery Parameters
body_typeoptionalone of "none" | "json" | "form_data" | "raw"Body Type
bodyoptionalobject (depends on other props)Body
response_is_binaryoptionalbooleanEnable for files like PDFs, images, etc.
failsafeoptionalbooleanNo Error on Failure
timeoutoptionalnumberTimeout (in seconds)
followRedirectsoptionalbooleanFollow redirects

delete_gdrive_file

Delete file. Delete permanently a file from your Google Drive

InputTypeDescription
fileIdrequiredtextThe ID of the file to delete
include_team_drivesoptionalbooleanDetermines if folders from Team Drives should be included in the results.

delete_permissions

Delete permissions. Removes a role from an user for a file or folder

InputTypeDescription
fileIdrequiredtextThe ID of the file or folder to update permissions for
user_emailrequiredtextThe email address of the user to update permissions for
permission_namerequiredone of "organizer" | "fileOrganizer" | "writer" | "commenter" | "reader"The role to remove from user.

duplicate_file

Duplicate File. Duplicate a file from Google Drive. Returns the new file ID.

InputTypeDescription
fileIdrequiredtextThe ID of the file to duplicate
namerequiredtextThe name of the new file
folderIdrequiredtextThe ID of the folder where the file will be duplicated
mimeTypeoptionalone of "application/vnd.google-apps.spreadsheet" | "application/vnd.google-apps.document"If left unselected the file will be duplicated as it is
include_team_drivesoptionalbooleanDetermines if folders from Team Drives should be included in the results.

get-file-or-folder-by-id

Get File Information. Get a file folder for files/sub-folders

InputTypeDescription
idrequiredtextThe Id of the file/folder to search for.
include_team_drivesoptionalbooleanDetermines if folders from Team Drives should be included in the results.

google-drive-move-file

Move File. Moves a file from one folder to another.

InputTypeDescription
fileIdrequiredtextYou can use **Search Folder/File** action to retrieve ID.
include_team_drivesoptionalbooleanDetermines if folders from Team Drives should be included in the results.
folderIdoptionalid (picked from your account)Parent Folder

save_file_as_pdf

Save Document as PDF. Save a document as PDF in a Google Drive folder

InputTypeDescription
documentIdrequiredtextThe ID of the document to export
folderIdrequiredtextThe ID of the folder where the file will be exported
namerequiredtextThe name of the new file (do not include the extension)
include_team_drivesoptionalbooleanDetermines if folders from Team Drives should be included in the results.

set_public_access

Set public access. Set public access for a file or folder

InputTypeDescription
fileIdrequiredtextThe ID of the file or folder to update permissions for
rolerequiredone of "reader" | "commenter" | "writer"The role to assign for public access

trash_gdrive_file

Trash file. Move a file to the trash in your Google Drive

InputTypeDescription
fileIdrequiredtextThe ID of the file to trash
include_team_drivesoptionalbooleanDetermines if folders from Team Drives should be included in the results.

update_permissions

Update permissions. Update permissions for a file or folder

InputTypeDescription
fileIdrequiredtextThe ID of the file or folder to update permissions for
user_emailrequiredtextThe email address of the user to update permissions for
permission_namerequiredone of "organizer" | "fileOrganizer" | "writer" | "commenter" | "reader"The role to grant to user. See more at: https://developers.google.com/drive/api/guides/ref-roles
include_team_drivesoptionalbooleanDetermines if folders from Team Drives should be included in the results.
send_invitation_emailrequiredbooleanSend an email to the user to notify them of the new permissions

upload_gdrive_file

Upload file. Upload a file in your Google Drive

InputTypeDescription
fileNamerequiredtextThe name of the file
filerequiredfileThe file URL or base64 to upload
parentFolderoptionalid (picked from your account)Parent Folder
include_team_drivesoptionalbooleanDetermines if folders from Team Drives should be included in the results.

Details

Id
google_drive
Category
Productivity
Tags
google, drive, files, storage, cloud
Package
@activepieces/piece-google-drive@0.7.1
Runs
Through the integration runner