> This page is for Agent Handler.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.merge.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.merge.dev/_mcp/server.

# Google Sheets

**Authentication:** OAuth. See [Magic Link](/merge-agent-handler/features/magic-link) for the runtime auth flow, or [Application credentials](/merge-agent-handler/admin-setup/add-oauth-credentials) to bring your own OAuth app.

## Sample use cases

* Append today's Stripe payouts to the `Finance / Daily` sheet, deduped by transaction ID.
* Pull the values from the `Q2 Forecast` sheet and post the rollup in #finance.
* Find rows in the `Leads` sheet where the email domain matches our top 10 target accounts.

## Available Tools

#### add\_sheet

Add a new sheet (tab) to an existing spreadsheet with customizable properties.

#### delete\_sheet

Permanently delete a sheet (tab) from a spreadsheet. Cannot be undone.

#### update\_sheet\_properties

Update sheet properties like title, position, visibility, or tab color.

#### copy\_sheet

Copy a sheet within the same spreadsheet or to a different spreadsheet.

#### sort\_range

Sorts data in rows based on a sort order per column. Supports multi-column sorting and color-based sorting.

#### set\_data\_validation

Sets data validation rules to cells in a range. Supports number, text, date validation, dropdown lists, and custom rules. Use empty rule to clear validation.

#### set\_basic\_filter

Sets a basic filter on a sheet with optional sorting and column-specific filter criteria. Supports text, number, and date filtering.

#### add\_chart

Add a chart (bar, line, area, column, scatter, combo, stepped area) to a spreadsheet. Requires A1 ranges for domain (x-axis) and series (y-axis) data.

#### create\_spreadsheet

Create a new spreadsheet with specified title and optional properties.

#### get\_spreadsheet

Retrieve spreadsheet information including metadata, sheets, and optionally cell data.

#### update\_spreadsheet\_properties

Update spreadsheet properties such as title, locale, or timezone.

#### get\_values

Read cell values from a specified range using A1 notation (e.g., 'Sheet1!A1:B10').

#### update\_values

Write cell values to a specified range. Supports formulas and raw values.

#### append\_values

Append rows to the end of a table, automatically finding the last row with data.

#### clear\_values

Clear cell values from a range while preserving formatting and structure.

#### batch\_get\_values

Read cell values from multiple ranges in a single efficient API call.

#### batch\_update\_values

Update multiple ranges with values in a single efficient API call.

#### batch\_clear\_values

Clear values from multiple ranges in a single API call while preserving formatting.

#### add\_banding

Apply alternating row or column colors (zebra striping) to a range. range accepts A1 notation (e.g. 'Sheet1!A1:E20') or a GridRange object.

#### add\_conditional\_format\_rule

Add a conditional formatting rule to one or more ranges. Provide either booleanRule (condition + format) or gradientRule (minpoint/midpoint/maxpoint),…

#### add\_dimension\_group

Create a collapsible row or column group for hierarchical reports. range.dimension is ROWS or COLUMNS; range.

#### add\_filter\_view

Create a named filter view with persistent filter/sort criteria. Unlike set\_basic\_filter, multiple filter views coexist without overwriting each other…

#### add\_named\_range

Create a named range so the cells can be referenced by name in formulas (e.g. =SUM(SalesData)). Names should be valid identifiers.

#### add\_protected\_range

Lock a range from edits. warning\_only=True shows a warning but still allows edits; False blocks them.

#### auto\_fill

Extend a pattern (formula, date sequence, number series) by auto-fill instead of writing each value.

#### auto\_resize\_dimensions

Auto-fit row heights or column widths to content. dimensions.dimension is ROWS or COLUMNS; start\_index/end\_index are zero-based, end-exclusive.

#### delete\_banding

Delete a banding rule by ID. Use get\_spreadsheet to find banded\_range\_id values on each sheet. This is irreversible.

#### delete\_conditional\_format\_rule

Delete a conditional format rule at the given 0-based index on a sheet. To inspect existing rules use get\_spreadsheet with include\_grid\_data=True.

#### delete\_dimension

Delete rows or columns from a sheet. range.dimension is ROWS or COLUMNS; range.start\_index/end\_index are zero-based, end-exclusive.

#### delete\_duplicates

Remove duplicate rows from a range, comparing only the columns listed in comparison\_columns (DimensionRange list). The first occurrence is kept.

#### delete\_embedded\_object

Delete an embedded chart or image by its id. The object\_id is the chart\_id returned by add\_chart, or read from get\_spreadsheet (sheets\[].charts\[].

#### delete\_filter\_view

Delete a named filter view by ID. Use get\_spreadsheet to find filter\_view\_id values on each sheet. This is irreversible.

#### delete\_named\_range

Delete a named range by ID. Use get\_spreadsheet to find named\_range\_id values. Formulas referencing the deleted name will break. This is irreversible.

#### duplicate\_sheet

Duplicate a sheet within the same spreadsheet using DuplicateSheetRequest. Unlike copy\_sheet (which uses :copyTo and auto-names the result), this lets…

#### find\_replace

Bulk find and replace text. Provide exactly one scope: a range (GridRange), a sheet\_id, or all\_sheets=True.

#### format\_cells

Apply cell-level formatting (number format, colors, fonts, alignment, wrap, borders, padding) to a range using RepeatCellRequest.

#### insert\_dimension

Insert empty rows or columns into a sheet. range.dimension selects ROWS or COLUMNS; range.start\_index/end\_index are zero-based, end-exclusive.

#### merge\_cells

Merge cells across a range. Discards content from all cells except the top-left of each merged block; not reversible via unmerge\_cells.

#### move\_dimension

Reorder rows or columns. source.dimension is ROWS or COLUMNS; source.start\_index/end\_index are zero-based, end-exclusive.

#### trim\_whitespace

Strip leading and trailing whitespace from string cells in a range. Returns the count of cells changed. Common cleanup after data import.

#### unmerge\_cells

Unmerge previously merged cells in a range. Useful for decomposing merged template cells before editing.

#### update\_banding

Update an existing banding rule's range or colors. Provide banded\_range\_id (from add\_banding or get\_spreadsheet) and the fields to change.

#### update\_borders

Set borders around a cell range. Each side (top/bottom/left/right) takes a Border with style and optional colorStyle.

#### update\_chart

Update an existing chart's spec — change chart type, title, or data ranges. Provide chart\_id (from add\_chart) and the spec fields to change.

#### update\_conditional\_format\_rule

Replace a conditional format rule at a given index, or move it to a new position. sheet\_id targets the sheet; index is the rule's current 0-based posi…

#### update\_dimension\_properties

Set column widths or row heights, or hide/show dimensions. range.dimension is ROWS or COLUMNS; range.

#### update\_embedded\_object\_position

Reposition an embedded object (chart or image) by id. Use new\_sheet\_id to move to another sheet, or overlay fields to set anchor cell, pixel offsets,…

#### update\_filter\_view

Update an existing named filter view. Provide filter\_view\_id (from add\_filter\_view or get\_spreadsheet) plus the fields to change.

#### update\_named\_range

Update an existing named range's name or cell range. Provide the named\_range\_id (from add\_named\_range or get\_spreadsheet); pass name and/or range to c…

#### add\_table

Add a table to a sheet over a GridRange (include the header row). Optionally set per-column names and types