> ## Documentation Index
> Fetch the complete documentation index at: https://docs.genesiscomputing.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Drive Tools

> Work with Google Drive, Sheets, Docs, and Slides from your workflows. Read, write, format, share, comment, and export results securely.

## **Overview**

### **Tool Name**

```json theme={null}
google_drive_tools
```

### **Purpose**

The **google\_drive\_tools** integration connects your workflows to Google Drive and Google Workspace. Create and edit Sheets and Docs, manage files and folders, read and import Google Slides decks, format content, collaborate with comments, and automate updates across projects.

Supports both **User OAuth** (recommended for interactive use) and **Service Account** (for automation and shared folders) authentication through **Config → Connections**.

### **Key Features & Functions**

<Steps>
  <Step title="Sheets Operations" icon="table-cells">
    Read and write cell ranges, append data, manage tabs, apply formatting and themes, and export query results to Google Sheets.
  </Step>

  <Step title="Docs Operations" icon="file-lines">
    Create, read, update, and append content in Google Docs. Create formatted documents and apply text formatting.
  </Step>

  <Step title="Native Slides Reads" icon="presentation-screen">
    Read Google Slides decks directly through the Slides API, preserve notes and structure, summarize decks, and import them into Genesis presentation apps.
  </Step>

  <Step title="Files and Folders" icon="folder-tree">
    List folders, get links, upload, download, move, and delete files.
  </Step>

  <Step title="Collaboration" icon="comments">
    Retrieve comments, add replies, and coordinate reviews without leaving your workflow.
  </Step>

  <Step title="Formatting" icon="palette">
    Apply cell formatting, sheet themes, conditional formatting, and format presets to Sheets. Format text in Docs.
  </Step>

  <Step title="Named Connections" icon="plug">
    Use multiple Google Workspace connections by name (e.g. `shared`, `finance`) for different teams or purposes.
  </Step>
</Steps>

## **Input Parameters**

### **`google_drive`**

**Core Parameters**

| **Name** | **Definition** | **Format** |
| - | - | :-: |
| **action** | Operation to perform (see action reference below). | String |
| **connection\_name** | Named Google Workspace connection to use (e.g. `shared`, `finance`). When omitted, Genesis resolves the effective default `google_workspace` connection for the current user (**My default**, then **Role default**). | String |
| **g\_folder\_id** | Folder id for listing or setting root. | String |
| **g\_file\_name** | Name filter or lookup. | String |
| **g\_file\_id** | Target file id. For Slides workflows this can also be a full Google Slides URL. | String |
| **g\_sheet\_cell** | A1 notation range (e.g. `A1:B10`, `Sheet1!C2:D100`). | String |
| **g\_sheet\_values** | Values to write, or comment text. | String |
| **max\_rows** | Maximum rows to return for `GET_SHEET` / `READ_SHEET`. Default `50`. Set `0` for no limit; not recommended for large sheets. | Integer |
| **g\_doc\_title** | Document or sheet title for creation. | String |
| **g\_doc\_content** | Body content to write. | String |
| **tab\_name** | Target tab/sheet name within a spreadsheet. | String |
| **write\_mode** | Write behavior: `overwrite` or `append`. | String |
| **tabs\_spec** | JSON spec for multi-tab exports. Include `connection_id` at the top level or on each tab. | String |
| **thread\_id** | Authentication context identifier. | String |

**Formatting Parameters**

| **Name** | **Definition** | **Format** |
| - | - | :-: |
| **apply\_formatting** | Apply formatting to sheet operations. | Boolean |
| **auto\_resize** | Auto-resize columns after writing. | Boolean |
| **formatting\_spec** | JSON formatting specification for cells. | String |
| **theme\_name** | Named theme to apply to a sheet. | String |
| **text\_range** | Text range for Doc formatting operations. | String |
| **sheet\_range** | Cell range for sheet formatting operations. | String |

**Presentation Parameters**

| **Name** | **Definition** | **Format** |
| - | - | :-: |
| **presentation\_url** | Full Google Slides URL. | String |
| **save\_to\_git** | Save extracted presentation markdown and JSON to a git repo. | Boolean |
| **git\_path** | Target markdown path when `save_to_git=true`. | String |
| **visual\_slide\_analysis** | Run visual fallback on image-heavy slides. | Boolean |
| **app\_id** | Target Genesis presentation app id for import. | String |

**File Parameters**

| **Name** | **Definition** | **Format** |
| - | - | :-: |
| **source\_path** | Source file path for upload. | String |
| **destination\_path** | Destination path for download. | String |

## **Action Reference**

### Drive & Folder Operations

| Action | Description |
| - | - |
| `LIST` | List files in a folder. Supports `summary_only` and `sort_by` options. |
| `GET_FILE_BY_NAME` | Find a file by name. |
| `GET_LINK_FROM_FILE_ID` | Get a shareable link for a file. |
| `GET_FILE_VERSION_NUM` | Get the version number of a file. |
| `SET_ROOT_FOLDER` / `SET_SHARED_FOLDER_ID` | Set the working folder for subsequent operations. |
| `GET_ROOT_FOLDER` / `GET_SHARED_FOLDER_ID` | Get the current working folder. |
| `MOVE_FILE` | Move a file to a different folder. |
| `DELETE_FILE` | Permanently delete a file from Drive. |
| `UPLOAD_FILE` | Upload a local file to Drive. |
| `DOWNLOAD_FILE` | Download a Drive file locally. |

### Sheets Operations

| Action | Description |
| - | - |
| `GET_SHEET` / `READ_SHEET` | Read cell values from a range. Returns up to `max_rows` rows by default (`50`) and includes truncation metadata when capped. |
| `EDIT_SHEET` | Write values to a range. |
| `WRITE_RANGE` | Write data to a specific range with write mode control. |
| `APPEND_RANGE` | Append rows to the end of a sheet. |
| `CREATE_SHEET` | Create a new spreadsheet. |
| `LIST_TABS` | List tab names in a spreadsheet. |
| `LIST_TABS_DETAILED` | List tabs with metadata (row counts, column counts). |
| `ADD_TAB` | Add a new tab to a spreadsheet. |
| `RENAME_TAB` | Rename an existing tab. |
| `DELETE_TAB` | Delete a tab from a spreadsheet. |
| `FORMAT_SHEET_CELLS` | Apply cell formatting (colors, borders, fonts). |
| `APPLY_SHEET_THEME` | Apply a named theme to a spreadsheet. |
| `ADD_CONDITIONAL_FORMATTING` | Add conditional formatting rules. |
| `APPLY_FORMAT_PRESET` | Apply a predefined format preset. |
| `SAVE_MULTI_QUERIES_TO_G_SHEET` | Run read-only SQL queries on a named connection (`connection_id` in `tabs_spec`, or per tab) and export the results to a multi-tab Sheet. |
| `SAVE_SHEET_TO_FILE` | Save a sheet as CSV or JSON in a git repo for full-data analysis. |
| `EXPORT_ALL_TABS_AS_CSV` | Export all tabs as CSV files. |
| `CSV_TO_SHEET` | Import a CSV file into a Sheet. |
| `GET_FORMATTING_EXAMPLES` | Show available formatting options and examples. |
| `GET_SAMPLE_FORMATTED` | Preview formatting on sample data. |

For `SAVE_MULTI_QUERIES_TO_G_SHEET`, each tab must name a database connection using
`connection_id` in `tabs_spec` or on that tab; there is no implicit default
connection. All tab queries are checked before execution; if any is not classified
as `READ` (including `UNKNOWN`), the export is refused before a sheet is created,
including on a dry run. Each query runs through `_query_database` on its selected
connection. Each tab keeps up to `100000` rows; a longer result is truncated and
marked `truncated` in that tab's result.

### Docs Operations

| Action | Description |
| - | - |
| `READ_DOC` | Read the content of a Google Doc. |
| `CREATE_DOC` | Create a new Google Doc. |
| `APPEND_DOC` | Append content to an existing Doc. |
| `UPDATE_DOC` | Replace content in a Doc. |
| `CREATE_FORMATTED_DOC` | Create a Doc with rich formatting (headings, lists, tables). |
| `FORMAT_DOC_TEXT` | Apply formatting to text ranges in an existing Doc. |

### Presentations (Google Slides)

| Action | Description |
| - | - |
| `FIND_PRESENTATIONS` | Search for Slides decks in Drive. |
| `READ_PRESENTATION` | Read a Slides deck: text, notes, structure, and metadata. |
| `SUMMARIZE_PRESENTATION` | Generate a summary of a deck's content. |
| `INSPECT_PRESENTATION_STRUCTURE` | Analyze slide layout, object counts, and structure. |
| `SAVE_PRESENTATION_ARTIFACTS` | Save presentation markdown and JSON artifacts to git. |
| `IMPORT_PRESENTATION_TO_APP` | Import a Slides deck into a Genesis presentation app. |

### Comments & Collaboration

| Action | Description |
| - | - |
| `GET_COMMENTS` | Retrieve comment threads on a file. |
| `ADD_COMMENT` | Add a new comment to a file. |
| `ADD_REPLY_TO_COMMENT` | Reply to an existing comment thread. |

### Setup & Authentication

| Action | Description |
| - | - |
| `SET_CREDENTIALS` | Configure service account credentials. |
| `TEST_CONNECTION` | Verify Drive and Slides API access. |
| `GET_SERVICE_ACCOUNT_EMAIL` | Show the active service account email. |
| `SETUP_GUIDE` | Display an interactive setup guide. |

## **Use Cases**

1. **Google Slides understanding and import**
   * Read a shared Slides URL directly, preserve speaker notes, inspect slide structure, summarize the deck, and import it into a Genesis presentation app.
2. **Stakeholder reporting**
   * Run SQL queries and export results to formatted, multi-tab Sheets with themes and conditional formatting.
3. **Living project docs**
   * Create formatted Docs per project, append meeting outcomes, and centralize decisions.
4. **Formatted spreadsheets**
   * Apply cell formatting, themes, and conditional formatting to create polished reports.
5. **Operational runbooks**
   * Keep checklists and status pages in Sheets, edited programmatically by scheduled jobs.
6. **Team reviews**
   * Fetch comment threads, add replies, and resolve items from a pipeline step.
7. **Multi-connection workflows**
   * Use `connection_name` to work with different teams' Drive folders in the same workflow.

<Warning>
  Deleting a file with `DELETE_FILE` removes it from Drive permanently. Confirm ownership, backups, and sharing expectations before proceeding.
</Warning>

## **Workflow**

1. **Set up a connection**
   * Create a Google Workspace connection in **Config → Connections** using User OAuth (recommended) or Service Account. See [Google Workspace Setup](/docs/Setup/Setup-Google-Workspace-API).
2. **Locate or create**
   * Use `LIST`, `GET_FILE_BY_NAME`, or `FIND_PRESENTATIONS` to find targets, or `CREATE_SHEET` and `CREATE_DOC` to start fresh.
3. **Read content**
   * `GET_SHEET` for Sheets, `READ_DOC` for Docs, `READ_PRESENTATION` or `SUMMARIZE_PRESENTATION` for Slides.
   * `GET_SHEET` / `READ_SHEET` returns at most `50` rows by default. For larger sheets, either narrow `g_sheet_cell` to a specific range such as `A1:Z200`, increase `max_rows`, or use `SAVE_SHEET_TO_FILE` to export the full sheet to git and analyze it there.
4. **Edit and format**
   * `EDIT_SHEET`, `WRITE_RANGE`, `FORMAT_SHEET_CELLS`, `APPLY_SHEET_THEME` for Sheets. `UPDATE_DOC`, `CREATE_FORMATTED_DOC`, `FORMAT_DOC_TEXT` for Docs.
5. **Export and share**
   * `SAVE_MULTI_QUERIES_TO_G_SHEET` for SQL-to-Sheet exports. `EXPORT_ALL_TABS_AS_CSV` for bulk CSV export. Use comment actions for collaboration.

## **Integration Relevance**

* **data\_connector\_tools** to run SQL that feeds `SAVE_MULTI_QUERIES_TO_G_SHEET`.
* **project\_manager\_tools** to attach Drive links to tasks and milestones.
* **artifact\_manager\_tools** to reference generated outputs by id.
* **handoff** to orchestrate spreadsheet updates as part of multi-agent routines.
* **slack\_tools** to distribute Drive links and comment status to channels.

## **Configuration Details**

* Set up connections through **Config → Connections** (not the legacy standalone page).
* User OAuth is preferred for interactive use; service accounts for automation.
* Use `connection_name` to select a specific connection when you have multiple.
* Enable Google Drive API, Google Sheets API, Google Docs API, and Google Slides API in the GCP project.
* Use A1 notation for ranges (e.g. `A1`, `A1:B10`, `Sheet1!C2:D100`).
* `GET_SHEET` / `READ_SHEET` uses `max_rows=50` by default. Set `max_rows=0` only when you intentionally want no row cap.
* Keep a designated shared folder for automation and set it with `SET_ROOT_FOLDER`.
* Git-backed sheet export actions such as `SAVE_SHEET_TO_FILE` and `EXPORT_ALL_TABS_AS_CSV` write files using the active Genesis user context.
* Large Google Slides decks are read in place via the Slides API; Drive export to `.pptx` is reserved for explicit artifact conversion.

## **Limitations**

1. API rate limits can throttle large batch operations. Use pagination and backoff.
2. Very large Sheets may have write limits per call. Split updates into smaller ranges.
3. Service account visibility depends on folder or file sharing. Share the specific deck or folder with the service account email.
4. Native Slides extraction preserves text, notes, links, and structure, but image-heavy decks may rely on visual analysis for best results.
5. Complex Docs formatting can vary when updated programmatically. Validate critical layouts.
6. Concurrent edits may produce version conflicts. Serialize writes for hot files.

## **Output**

* **File and Folder Operations**
  * Listings with ids, names, mime types, and modified timestamps.
* **Sheets**
  * `GET_SHEET` / `READ_SHEET` returns `values`, `row_count`, `total_row_count`, `column_count`, `truncated`, and tab metadata when available.
  * When a sheet response is too large for context, `values` is omitted and a `summary` with `headers`, `preview_rows`, `tail_rows`, and `original_size_bytes` is returned instead.
  * Truncated reads include a `truncation_note` that points you to a narrower `g_sheet_cell` range or `SAVE_SHEET_TO_FILE` for full export.
* **Docs**
  * Document content snapshots, append confirmations, update results, and formatted document links.
* **Slides**
  * Deck summaries, structured slide/page metadata, speaker notes, thumbnail metadata, and optional git-saved markdown/JSON artifacts.
* **Comments**
  * Comment threads, new comment ids, and reply confirmations.
* **Exports**
  * New Sheet id, title, and a shareable link after `SAVE_MULTI_QUERIES_TO_G_SHEET`.

<Warning>
  Align permissions with your workspace policies. Use least privilege for service accounts and restrict automation to shared folders intended for data agents.
</Warning>
