Google Drive
Upload files, create folders, and manage content in Google Drive.
On this page
- Connect
- Call it from a workflow
- Actions (16)
- list-files
- read-file
- search-folder
- create_new_gdrive_file
- create_new_gdrive_folder
- custom_api_call
- delete_gdrive_file
- delete_permissions
- duplicate_file
- get-file-or-folder-by-id
- google-drive-move-file
- save_file_as_pdf
- set_public_access
- trash_gdrive_file
- update_permissions
- upload_gdrive_file
- 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.
// 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);
});{
"name": "integrations",
"arguments": {
"project_id": "<project-id>",
"action": "call",
"piece": "google_drive",
"piece_action": "list-files",
"input": {
"folderId": "<folder id>"
},
"env": "dev"
}
}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.
| Input | Type | Description |
|---|---|---|
folderIdrequired | text | Folder ID coming from | New Folder -> id | (or any other source) |
include_team_drivesoptional | boolean | Determines if folders from Team Drives should be included in the results. |
includeTrashedoptional | boolean | Include new files that have been trashed. |
depthLeveloptional | number | How many levels deep to search for files. 1 = current folder only, 2 = current + next level, etc. |
downloadFilesoptional | boolean | Download all file contents in a list |
read-file
Read File Content. Read a selected file from google drive file
| Input | Type | Description |
|---|---|---|
fileIdrequired | text | File ID coming from | New File -> id | |
fileNameoptional | text | Destination File name |
search-folder
Search. Search a Google Drive folder for files/sub-folders
| Input | Type | Description |
|---|---|---|
queryTermrequired | one of "name" | "fullText" | "mimeType" | The Query term or field of file/folder to search upon. |
operatorrequired | one of "contains" | "=" | The operator to create criteria. |
queryrequired | text | Value of the field of file/folder to search for. |
typeoptional | one of "all" | "file" | "folder" | (Optional) Choose between files and folders. |
parentFolderoptional | id (picked from your account) | Parent Folder |
include_team_drivesoptional | boolean | Determines 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
| Input | Type | Description |
|---|---|---|
fileNamerequired | text | The name of the new text file |
textrequired | long text | The text content to add to file |
fileTyperequired | one of "plain/text" | "text/csv" | "text/xml" | Select file type |
parentFolderoptional | id (picked from your account) | Parent Folder |
include_team_drivesoptional | boolean | Determines 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
| Input | Type | Description |
|---|---|---|
folderNamerequired | text | The name of the new folder |
parentFolderoptional | id (picked from your account) | Parent Folder |
include_team_drivesoptional | boolean | Determines 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
| Input | Type | Description |
|---|---|---|
urlrequired | object (depends on other props) | url |
methodrequired | one of "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | "HEAD" | Method |
headersrequired | object | Authorization headers are injected automatically from your connection. |
queryParamsrequired | object | Query Parameters |
body_typeoptional | one of "none" | "json" | "form_data" | "raw" | Body Type |
bodyoptional | object (depends on other props) | Body |
response_is_binaryoptional | boolean | Enable for files like PDFs, images, etc. |
failsafeoptional | boolean | No Error on Failure |
timeoutoptional | number | Timeout (in seconds) |
followRedirectsoptional | boolean | Follow redirects |
delete_gdrive_file
Delete file. Delete permanently a file from your Google Drive
| Input | Type | Description |
|---|---|---|
fileIdrequired | text | The ID of the file to delete |
include_team_drivesoptional | boolean | Determines 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
| Input | Type | Description |
|---|---|---|
fileIdrequired | text | The ID of the file or folder to update permissions for |
user_emailrequired | text | The email address of the user to update permissions for |
permission_namerequired | one 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.
| Input | Type | Description |
|---|---|---|
fileIdrequired | text | The ID of the file to duplicate |
namerequired | text | The name of the new file |
folderIdrequired | text | The ID of the folder where the file will be duplicated |
mimeTypeoptional | one of "application/vnd.google-apps.spreadsheet" | "application/vnd.google-apps.document" | If left unselected the file will be duplicated as it is |
include_team_drivesoptional | boolean | Determines 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
| Input | Type | Description |
|---|---|---|
idrequired | text | The Id of the file/folder to search for. |
include_team_drivesoptional | boolean | Determines 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.
| Input | Type | Description |
|---|---|---|
fileIdrequired | text | You can use **Search Folder/File** action to retrieve ID. |
include_team_drivesoptional | boolean | Determines if folders from Team Drives should be included in the results. |
folderIdoptional | id (picked from your account) | Parent Folder |
save_file_as_pdf
Save Document as PDF. Save a document as PDF in a Google Drive folder
| Input | Type | Description |
|---|---|---|
documentIdrequired | text | The ID of the document to export |
folderIdrequired | text | The ID of the folder where the file will be exported |
namerequired | text | The name of the new file (do not include the extension) |
include_team_drivesoptional | boolean | Determines 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
| Input | Type | Description |
|---|---|---|
fileIdrequired | text | The ID of the file or folder to update permissions for |
rolerequired | one 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
| Input | Type | Description |
|---|---|---|
fileIdrequired | text | The ID of the file to trash |
include_team_drivesoptional | boolean | Determines if folders from Team Drives should be included in the results. |
update_permissions
Update permissions. Update permissions for a file or folder
| Input | Type | Description |
|---|---|---|
fileIdrequired | text | The ID of the file or folder to update permissions for |
user_emailrequired | text | The email address of the user to update permissions for |
permission_namerequired | one 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_drivesoptional | boolean | Determines if folders from Team Drives should be included in the results. |
send_invitation_emailrequired | boolean | Send an email to the user to notify them of the new permissions |
upload_gdrive_file
Upload file. Upload a file in your Google Drive
| Input | Type | Description |
|---|---|---|
fileNamerequired | text | The name of the file |
filerequired | file | The file URL or base64 to upload |
parentFolderoptional | id (picked from your account) | Parent Folder |
include_team_drivesoptional | boolean | Determines 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