> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/google-drive.md).

# Google Drive

Connect Google Drive to make files available to StackAI or work with files in a workflow. Choose the path that matches your task:

* **Answer questions using a selected set of documents:** [create a knowledge base](https://docs.stackai.com/guides-and-quickstarts/knowledge-and-retrieval/create-a-knowledge-base.md) and add the files you want to index.
* **Search the connected service when a question is asked:** use [Federated Search](https://docs.stackai.com/guides-and-quickstarts/agent-builder-and-skills/search-connected-apps-with-federated-search.md).
* **Read, create, move, or update a file in a workflow:** choose an action from the reference below.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector    | Authentication |
| ------------ | -------------- |
| Google Drive | OAuth sign-in  |

#### Google Drive

Connect to Google Drive to access your documents, spreadsheets, and files. Supports reading, writing, and searching files.

**Set up in Google Drive**

1. Sign in with your Google account when the Google window opens.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **Google Drive**.
2. Select **Connect**, sign in to the provider account, and review the requested access. Complete authorization to return to StackAI.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

StackAI obtains the OAuth credentials during sign-in. You do not need to paste an access token or refresh token.

**Provider documentation:** [Setup reference](https://developers.google.com/drive/api/guides/about-sdk).

#### Verify the connection

Check that the connection is healthy, then verify access with a read operation:

1. Add **Get File** and select the saved Google Drive connection.
2. In **File**, select a file that the connected Google account can read. Leave **Parse Content** enabled for a supported text document.
3. Run the action. Confirm the file's identity in **File Metadata** and inspect **Parsed Text Content**. Reading one file does not establish access to other files or shared drives.

A successful connection check confirms authentication. It does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **Google Drive** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### Get File

Get a file's metadata, content, or parsed text from Google Drive

**Inputs**

| Field               | Type         | Required | Description                                                                       |
| ------------------- | ------------ | -------- | --------------------------------------------------------------------------------- |
| File                | file\_picker | Yes      | Browse your Google Drive to select a file, or enter a file ID manually.           |
| Parse Content       | boolean      | No       | Whether to parse the file content into text using DocumentFactory. Default: true. |
| Use OCR             | boolean      | No       | Whether to use OCR for processing images and scanned documents. Default: false.   |
| Chunk Length        | integer      | No       | Length of text chunks when parsing documents (default: 1500). Default: 1500.      |
| Alt                 | string       | No       | Query param: alt (e.g. 'media' to download file content).                         |
| Acknowledge Abuse   | boolean      | No       | Query param: acknowledgeAbuse (set true to acknowledge risk).                     |
| Revision ID         | string       | No       | Query param: revisionId (specifies revision to download).                         |
| Supports All Drives | boolean      | No       | Query param: supportsAllDrives. Default: true.                                    |

**Outputs**

| Field                 | Type   | Description                                                                |
| --------------------- | ------ | -------------------------------------------------------------------------- |
| Result Message        | string | A message indicating the result of the file get operation.                 |
| File Metadata         | object | Metadata of the file.                                                      |
| File Content (base64) | string | Base64-encoded file content (if not parsed).                               |
| Parsed Text Content   | string | Parsed text content from the file (if parse\_content=True).                |
| Document Pages        | string | Structured document pages with text and metadata (if parse\_content=True). |
| Download URL          | string | The download URL of the file uploaded to storage.                          |

#### Create File

Create a file in Google Drive from a URL or base64 content, optionally converting it to a native Google Docs/Sheets/Slides document.

**Inputs**

| Field                    | Type            | Required | Description                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------ | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| File Name                | string          | Yes      | Name of the file to create.                                                                                                                                                                                                                                                                                                                                            |
| File Type                | select (string) | No       | The file's format. Leave on Auto-detect to work it out from the file itself. Available values: Auto-detect, PDF, Plain Text, CSV, JSON, Word Document, Word Document (DOCX), Excel Spreadsheet, Excel Spreadsheet (XLSX), PowerPoint Presentation, PowerPoint Presentation (PPTX), JPEG Image, PNG Image, GIF Image, ZIP Archive, MP4 Video, MP3 Audio. Default: auto. |
| Convert to Google Format | select (string) | No       | Turn the upload into an editable Google file. Auto converts when it can: Excel and CSV become Google Sheets, Word becomes Docs, PowerPoint becomes Slides. Everything else uploads unchanged. Pick Keep original to never convert, or name a format to force it. Available values: Keep original, Auto, Google Docs, Google Sheets, Google Slides. Default: keep.      |
| Parent Folder IDs        | string\_array   | No       | List of parent folder IDs (optional).                                                                                                                                                                                                                                                                                                                                  |
| File Content (base64)    | string          | No       | Base64-encoded file content (optional). If omitted, creates metadata-only file.                                                                                                                                                                                                                                                                                        |
| File URL                 | string          | No       | URL of the file to upload (optional). If omitted, creates metadata-only file.                                                                                                                                                                                                                                                                                          |
| Description              | string          | No       | Description of the file (optional).                                                                                                                                                                                                                                                                                                                                    |
| Starred                  | boolean         | No       | Would you like to star the file? (optional, default: false).                                                                                                                                                                                                                                                                                                           |

**Outputs**

| Field          | Type   | Description                                                   |
| -------------- | ------ | ------------------------------------------------------------- |
| Result Message | string | A message indicating the result of the file create operation. |
| File Metadata  | object | Metadata of the created file.                                 |

#### Delete File

Delete a file from Google Drive (move to trash or permanently delete)

**Inputs**

| Field              | Type            | Required | Description                                                                                                |
| ------------------ | --------------- | -------- | ---------------------------------------------------------------------------------------------------------- |
| Drive              | select (string) | No       | Select a Shared Drive, or leave as My Drive. Options load from the selected connection. Default: my-drive. |
| File to Delete     | select (string) | Yes      | Choose the file you want to remove. Options load from the selected connection.                             |
| Delete Permanently | boolean         | No       | Skip trash and delete forever (cannot be undone). Default: false.                                          |

**Outputs**

| Field               | Type    | Description                                                 |
| ------------------- | ------- | ----------------------------------------------------------- |
| Result Message      | string  | A message indicating the result of the delete operation.    |
| Deleted File ID     | string  | The ID of the deleted file.                                 |
| Permanently Deleted | boolean | Whether the file was permanently deleted or moved to trash. |

#### Move File

Move a file to a different folder in Google Drive

**Inputs**

| Field        | Type            | Required | Description                                                                                                |
| ------------ | --------------- | -------- | ---------------------------------------------------------------------------------------------------------- |
| Drive        | select (string) | No       | Select a Shared Drive, or leave as My Drive. Options load from the selected connection. Default: my-drive. |
| File to Move | select (string) | Yes      | Choose the file you want to relocate. Options load from the selected connection.                           |
| Move To      | select (string) | Yes      | Choose the folder where the file will be moved. Options load from the selected connection.                 |

**Outputs**

| Field          | Type   | Description                                            |
| -------------- | ------ | ------------------------------------------------------ |
| Result Message | string | A message indicating the result of the move operation. |
| File Metadata  | object | Updated metadata of the moved file.                    |

#### Update File

Update a file's metadata or replace its content in Google Drive. Falls back to creating a new file on permission errors.

**Inputs**

| Field          | Type            | Required | Description                                                                                                |
| -------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------- |
| Drive          | select (string) | No       | Select a Shared Drive, or leave as My Drive. Options load from the selected connection. Default: my-drive. |
| File to Update | select (string) | Yes      | Choose the file you want to modify. Options load from the selected connection.                             |
| New Name       | string          | No       | Enter a new name, or leave empty to keep current.                                                          |
| Description    | string          | No       | Add a description to help identify this file.                                                              |
| Add to Starred | boolean         | No       | Mark this file as a favorite for quick access.                                                             |
| File URL       | string          | No       | URL to download replacement content from.                                                                  |

**Outputs**

| Field          | Type   | Description                                              |
| -------------- | ------ | -------------------------------------------------------- |
| Result Message | string | A message indicating the result of the update operation. |
| File Metadata  | object | Updated metadata of the file.                            |
| Method         | string | Whether the file was 'updated' or 'created' (fallback).  |

#### Share File or Folder

Share a file or folder with users, groups, domains, or make it public

**Inputs**

| Field                   | Type            | Required | Description                                                                                                                   |
| ----------------------- | --------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------- |
| Drive                   | select (string) | No       | Select a Shared Drive, or leave as My Drive. Options load from the selected connection. Default: my-drive.                    |
| File or Folder          | select (string) | Yes      | Select the file or folder to share. Options load from the selected connection.                                                |
| Share With              | select (string) | Yes      | Who to share the file with. Available values: Person or group, Everyone in my organization, Anyone with link.                 |
| Access Level            | select (string) | No       | What the recipient can do with the file. Available values: Viewer (read-only), Commenter, Editor (can edit). Default: reader. |
| Email Addresses         | string          | No       | Email addresses to share with (comma-separated for multiple).                                                                 |
| Domain                  | string          | No       | Your organization's domain name.                                                                                              |
| Send Notification Email | boolean         | No       | Send an email to let them know you've shared.                                                                                 |
| Message                 | string          | No       | Add a personal message to the notification.                                                                                   |

**Outputs**

| Field          | Type   | Description                                             |
| -------------- | ------ | ------------------------------------------------------- |
| Result Message | string | A message indicating the result of the share operation. |
| Permission ID  | string | ID(s) of the created permission(s).                     |
| Shareable Link | string | Link to access the shared file or folder.               |

#### Create Shareable Link

Create a link that anyone can use to access a file or folder

**Inputs**

| Field            | Type            | Required | Description                                                                                                            |
| ---------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
| Drive            | select (string) | No       | Select a Shared Drive, or leave as My Drive. Options load from the selected connection. Default: my-drive.             |
| File or Folder   | select (string) | Yes      | Choose what you want to create a shareable link for. Options load from the selected connection.                        |
| Link Permissions | select (string) | No       | What anyone with the link can do. Available values: Viewer (read-only), Commenter, Editor (can edit). Default: reader. |

**Outputs**

| Field          | Type   | Description                                            |
| -------------- | ------ | ------------------------------------------------------ |
| Result Message | string | A message indicating the result of the operation.      |
| Shareable Link | string | Link that anyone can use to access the file or folder. |
| Name           | string | Name of the file or folder.                            |
| Access Level   | string | What people with the link can do.                      |

#### Get Download Link

Get a download URL for a file in Google Drive

**Inputs**

| Field            | Type            | Required | Description                                                                                                |
| ---------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------- |
| Drive            | select (string) | No       | Select a Shared Drive, or leave as My Drive. Options load from the selected connection. Default: my-drive. |
| File to Download | select (string) | Yes      | Choose the file you want to download. Options load from the selected connection.                           |

**Outputs**

| Field          | Type   | Description                                                                                    |
| -------------- | ------ | ---------------------------------------------------------------------------------------------- |
| Result Message | string | A message indicating the result of the download operation.                                     |
| Download URL   | string | API download URL for the file. Note: This URL requires authentication (OAuth token) to access. |
| File Metadata  | object | Metadata of the file.                                                                          |

#### Search Files

Search for files in Google Drive by name, type, or custom query

**Inputs**

| Field                   | Type            | Required | Description                                                                                                                                                                        |
| ----------------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Drive                   | select (string) | No       | Select a Shared Drive, or leave as My Drive. Options load from the selected connection. Default: my-drive.                                                                         |
| Search by Name          | string          | No       | Find files containing this text in their name.                                                                                                                                     |
| Search In               | select (string) | No       | Limit search to a specific folder, or leave empty to search entire drive. Options load from the selected connection.                                                               |
| File Type               | select (string) | No       | Filter by file type. Available values: All Files, Documents (Google Docs), Spreadsheets (Google Sheets), Presentations (Google Slides), PDFs, Images, Videos, Audio. Default: all. |
| Custom Query (Advanced) | string          | No       | For power users: write custom search queries.                                                                                                                                      |

**Outputs**

| Field          | Type        | Description                                              |
| -------------- | ----------- | -------------------------------------------------------- |
| Result Message | string      | A message indicating the result of the search operation. |
| Files          | dict\_array | List of files matching the search criteria.              |
| Total Count    | number      | Number of files found.                                   |

#### Create Folder

Create a new folder in Google Drive

**Inputs**

| Field               | Type            | Required | Description                                                                                                |
| ------------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------- |
| Drive               | select (string) | No       | Select a Shared Drive, or leave as My Drive. Options load from the selected connection. Default: my-drive. |
| Destination Folder  | select (string) | No       | Leave empty to create at root of the drive. Options load from the selected connection.                     |
| Folder Name         | string          | Yes      | Name for the new folder.                                                                                   |
| Skip if Name Exists | boolean         | No       | Returns the existing folder if one with the same name already exists. Default: false.                      |

**Outputs**

| Field           | Type    | Description                                                              |
| --------------- | ------- | ------------------------------------------------------------------------ |
| Result Message  | string  | A message indicating the result of the create operation.                 |
| Folder Metadata | object  | Metadata of the created folder.                                          |
| Already Existed | boolean | Whether the folder already existed (when create\_if\_unique is enabled). |

#### Search Folders

Search for folders in Google Drive by name

**Inputs**

| Field          | Type            | Required | Description                                                                                                          |
| -------------- | --------------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
| Drive          | select (string) | No       | Select a Shared Drive, or leave as My Drive. Options load from the selected connection. Default: my-drive.           |
| Search by Name | string          | Yes      | Search for folders containing this text.                                                                             |
| Search In      | select (string) | No       | Limit search to a specific folder, or leave empty to search entire drive. Options load from the selected connection. |

**Outputs**

| Field          | Type        | Description                                              |
| -------------- | ----------- | -------------------------------------------------------- |
| Result Message | string      | A message indicating the result of the search operation. |
| Folders        | dict\_array | List of folders matching the search criteria.            |
| Total Count    | number      | Number of folders found.                                 |

### Triggers

A trigger starts a workflow when its configured event occurs. Configure the event and filters before enabling the trigger.

#### On Drive Change

Trigger a workflow execution when any changes occur in Google Drive.

**Configuration**

| Field             | Type            | Required | Description                                                                                                                                                           |
| ----------------- | --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Trigger when...   | select (string) | No       | What type of file change should trigger this workflow. Available values: Any file activity, A new file is added, A file is modified, A file is deleted. Default: all. |
| Source Drive      | select (string) | No       | Select My Drive or a Shared Drive to monitor. Options load from the selected connection. Default: my-drive.                                                           |
| Folder to Monitor | select (string) | No       | Monitor changes in a specific folder, or leave empty for entire drive. Options load from the selected connection.                                                     |
| Specific File     | select (string) | No       | Monitor a single file only, or leave empty to watch all files. Options load from the selected connection.                                                             |

**Event inputs**

| Field                 | Type   | Required | Description                                                             |
| --------------------- | ------ | -------- | ----------------------------------------------------------------------- |
| Resource State        | string | Yes      | The state change that occurred (e.g., 'change', 'sync'). Default: None. |
| Changed Resource ID   | string | Yes      | The ID of the changed resource. Default: None.                          |
| Changed Resource Name | string | Yes      | The name of the changed resource. Default: NaN.                         |
| Change Type           | string | No       | The type of change (new\_file, updated, deleted). Default: unknown.     |
| MIME Type             | string | No       | The MIME type of the changed file.                                      |
| Parent Folder ID      | string | No       | The ID of the parent folder containing the changed file.                |
| Modified Time         | string | No       | The last modification timestamp of the file.                            |

**Outputs**

| Field                 | Type   | Description                                              |
| --------------------- | ------ | -------------------------------------------------------- |
| Resource State        | string | The type of change that occurred.                        |
| Changed Resource ID   | string | The ID of the changed resource.                          |
| Changed Resource Name | string | The name of the changed resource.                        |
| Change Type           | string | The type of change (new\_file, updated, deleted).        |
| MIME Type             | string | The MIME type of the changed file.                       |
| Parent Folder ID      | string | The ID of the parent folder containing the changed file. |
| Modified Time         | string | The last modification timestamp of the file.             |

### Important behavior

If an operation is denied, check the connection’s granted permissions and the account’s access in the provider. Reauthorize the connection when it needs additional permissions.

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/google-drive.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
