Google Sheets
Connects to the Google Sheets API v4 (and the Drive API for file-level operations) for reading, writing, formatting, and managing spreadsheets. An agent can read and write ranges, manage sheets and structure, format cells, build charts and pivot tables, validate and protect data, and more.
Add to an agent node's tools array with _node_type: "tool-google-sheets". See Connector Reference — How connectors are used.
Authentication
| Field | Required | Description |
|---|---|---|
access_token | Yes | Google OAuth access token, sent as Authorization: Bearer <access_token>. Typically resolved via oauth_connection_id. Spreadsheet-creation, deletion, and copy tools additionally require the drive.file OAuth scope. |
{
"name": "google_sheets",
"_node_type": "tool-google-sheets",
"oauth_connection_id": "{{ connection.google }}"
}
Tools
Spreadsheet lifecycle
sheets_create_spreadsheet
Create a brand-new Google Sheets spreadsheet. Requires drive.file OAuth scope. Returns the spreadsheet ID and URL.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Title of the new spreadsheet |
locale | string | No | Locale (e.g. en_US). Optional. |
Returns: A confirmation message with the spreadsheet's title, ID, and URL.
sheets_delete_spreadsheet
Permanently delete a Google Sheets spreadsheet via the Drive API. Requires drive.file scope.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID to delete |
Returns: A confirmation message naming the deleted spreadsheet ID.
sheets_copy_spreadsheet
Create a full copy of a spreadsheet using the Drive API. Returns new spreadsheet ID and URL.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Source spreadsheet ID to copy |
new_title | string | Yes | Title for the copied spreadsheet |
Returns: A confirmation message with the new title, new spreadsheet ID, and URL.
sheets_get_spreadsheet_meta
Get full spreadsheet metadata: title, locale, time zone, sheets, named ranges, and developer metadata.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
Returns: Pretty-printed JSON of the spreadsheet's properties and sheets fields.
Data I/O
sheets_read_range
Read a range of cells. Returns tab-separated data.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
range | string | Yes | A1 notation range (e.g. Sheet1!A1:D10) |
Returns: Tab-separated rows (one per line) of cell values, or "No data in range.".
sheets_read_formulas
Read cell formulas (=SUM(...) etc) instead of computed values.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
range | string | Yes | A1 notation range |
Returns: Tab-separated rows of formula strings, or "No data in range.".
sheets_read_formatted_values
Read cells as they appear on screen (formatted strings like $1,234.56 or 12/31/2024).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
range | string | Yes | A1 notation range |
Returns: Tab-separated rows of formatted display values, or "No data in range.".
sheets_write_range
Write values to a range. Supports strings, numbers, and formulas. Auto-batches large writes.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
range | string | Yes | A1 notation range. Sheet tab must exist. |
values | array of arrays | No | 2D array of values (under 50 rows). Supports strings, numbers, and formulas. |
csv_data | string | No | Tab-separated data with newlines. Use for 50+ rows. |
Returns: A confirmation message with the number of cells updated and the target range. Returns an error if neither values nor csv_data is provided.
sheets_batch_write
Write large datasets using compact tab-separated format. Auto-batches in chunks of 1000 rows.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
csv_data | string | Yes | Tab-separated data with newlines |
sheet_name | string | No | Sheet tab (default: Sheet1) |
start_cell | string | No | Starting cell (default: A1) |
Returns: A confirmation message with the number of cells and rows written and the target range.
sheets_append_row
Append a single row at the bottom of a sheet.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_name | string | No | Sheet tab (default: Sheet1) |
row | array | Yes | Row values to append |
Returns: A confirmation message with the range the row was appended at.
sheets_batch_update_cells
Update multiple non-contiguous ranges in one call. Each range maps to tab-separated data.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
range_data | object (map of string to string) | Yes | Map of A1 ranges to tab-separated row data |
Returns: A confirmation message with the total cells updated and the number of ranges.
sheets_clear_range
Clear all values in a range without deleting the cells.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
range | string | Yes | A1 notation range to clear |
Returns: A confirmation message naming the cleared range.
sheets_find
Find cells matching a search string. Returns sheet name, cell reference, and value.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
query | string | Yes | Text to search for |
sheet_name | string | No | Specific sheet to search (all if empty) |
case_sensitive | boolean | No | Case-sensitive search |
max_results | number | No | Max matches to return (default: 50) |
Returns: A count and list of <sheet>!<cell>: <value> matches, or "No matches found for '<query>'".
sheets_find_replace
Find and replace text across a sheet or the entire spreadsheet. Supports regex.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
find | string | Yes | Text to find |
replacement | string | Yes | Replacement text |
sheet_id | number | No | Limit to this sheet ID (omit for all sheets) |
range | string | No | Limit to this A1 range (omit for all) |
match_case | boolean | No | Case-sensitive match |
match_entire_cell | boolean | No | Match entire cell contents only |
search_by_regex | boolean | No | Treat find as a regex pattern |
include_formulas | boolean | No | Search inside formulas too |
Returns: A confirmation message with the number of occurrences replaced.
sheets_paste_data
Paste raw delimited text data at a specific cell (like pasting CSV). Useful for importing.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
row | number | Yes | 0-based row index to paste at |
col | number | Yes | 0-based column index to paste at |
data | string | Yes | Raw data to paste (comma or tab separated) |
delimiter | string | No | Delimiter: COMMA or CUSTOM (default: COMMA) |
custom_delimiter | string | No | Custom delimiter character when delimiter=CUSTOM |
Returns: A confirmation message naming the row and column pasted at.
sheets_cut_paste
Cut a range and paste it to a new location (moves data, clears source).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
source_sheet_id | number | Yes | Source sheet numeric ID |
source_start | array of 2 numbers | Yes | [row, col] 0-based start of source range |
source_end | array of 2 numbers | Yes | [row, col] 0-based exclusive end of source range |
dest_sheet_id | number | Yes | Destination sheet ID |
dest_row | number | Yes | Destination row (0-based) |
dest_col | number | Yes | Destination column (0-based) |
paste_type | string | No | PASTE_NORMAL, PASTE_VALUES, PASTE_FORMAT, PASTE_FORMULA (default: PASTE_NORMAL) |
Returns: "Cut and paste complete."
sheets_copy_paste
Copy a range and paste it to a new location (source is preserved).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
source_sheet_id | number | Yes | Source sheet numeric ID |
source_start | array of 2 numbers | Yes | [row, col] 0-based start |
source_end | array of 2 numbers | Yes | [row, col] 0-based exclusive end |
dest_sheet_id | number | Yes | Destination sheet ID |
dest_start | array of 2 numbers | Yes | [row, col] 0-based destination start |
dest_end | array of 2 numbers | Yes | [row, col] 0-based destination end |
paste_type | string | No | PASTE_NORMAL, PASTE_VALUES, PASTE_FORMAT, PASTE_FORMULA (default: PASTE_NORMAL) |
Returns: "Copy and paste complete."
Structure — rows & columns
sheets_add_rows
Insert empty rows at a specific position.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | 0-based row index to insert before |
count | number | Yes | Number of rows to insert |
Returns: A confirmation message with the number of rows inserted and the position.
sheets_add_columns
Insert empty columns at a specific position.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_col | number | Yes | 0-based column index to insert before (A=0) |
count | number | Yes | Number of columns to insert |
Returns: A confirmation message with the number of columns inserted and the column letter.
sheets_delete_rows
Delete a range of rows from a sheet.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | 0-based start row index to delete |
end_row | number | Yes | 0-based exclusive end row index |
Returns: A confirmation message naming the deleted row range.
sheets_delete_columns
Delete a range of columns from a sheet.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_col | number | Yes | 0-based start column index |
end_col | number | Yes | 0-based exclusive end column index |
Returns: A confirmation message naming the deleted column range (as letters).
sheets_move_rows
Move rows to a different position within the same sheet.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | 0-based start row index to move |
end_row | number | Yes | 0-based exclusive end row index |
destination_index | number | Yes | 0-based index to move rows to |
Returns: A confirmation message naming the moved row range and destination index.
sheets_move_columns
Move columns to a different position within the same sheet.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_col | number | Yes | 0-based start column index |
end_col | number | Yes | 0-based exclusive end column index |
destination_index | number | Yes | 0-based index to move columns to |
Returns: A confirmation message naming the moved column range and destination index.
Sheet management
sheets_get_info
Get all sheet tab names with their IDs, row/col counts, and frozen counts.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
Returns: A multi-line summary listing the spreadsheet title and each sheet's title, sheetId, dimensions, and frozen row/column counts.
sheets_create_sheet
Create a new sheet tab. Returns the new sheet ID needed for formatting/charts.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
title | string | Yes | Name for the new sheet tab |
tab_color | string | No | Tab color as hex (e.g. #4285F4) |
rows | number | No | Initial row count (default: 1000) |
cols | number | No | Initial column count (default: 26) |
Returns: A confirmation message with the new sheet's title and sheetId, or a message that the tab already exists.
sheets_delete_sheet
Delete a sheet tab by its numeric ID.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
Returns: A confirmation message naming the deleted sheet ID.
sheets_rename_sheet
Rename a sheet tab.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
new_name | string | Yes | New name for the sheet tab |
Returns: A confirmation message naming the sheet ID and new name.
sheets_copy_sheet
Copy a sheet tab to another spreadsheet (or the same one). Returns new sheet ID.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
source_spreadsheet_id | string | Yes | Source spreadsheet ID |
source_sheet_id | number | Yes | Numeric sheet ID to copy |
dest_spreadsheet_id | string | Yes | Destination spreadsheet ID |
Returns: A confirmation message with the new sheet's title and sheetId.
sheets_move_sheet
Move a sheet tab to a different position in the tab bar.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID to move |
new_index | number | Yes | 0-based position to move the sheet to |
Returns: A confirmation message naming the sheet ID and new index.
sheets_show_hide_sheet
Hide or show a sheet tab.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
hidden | boolean | Yes | true to hide the sheet, false to show it |
Returns: A confirmation message naming the sheet ID and the action taken (Shown/Hidden).
sheets_duplicate_sheet
Duplicate a sheet within the same spreadsheet with a new name.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID to duplicate |
new_sheet_name | string | Yes | Name for the duplicate sheet |
insert_sheet_index | number | No | Position for the new sheet (0-based) |
Returns: A confirmation message with the new sheet's name and sheetId.
sheets_resize_sheet
Change the total row/column count of a sheet.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
row_count | number | No | New row count |
col_count | number | No | New column count |
Returns: A confirmation message with the new dimensions. Returns an error if neither row_count nor col_count is given.
Formatting
sheets_format_cells
Format cells: background, font (bold/italic/underline/strikethrough/size/family/color), alignment, number format, borders, wrap, padding.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | Start row index (0-based) |
end_row | number | Yes | End row index (exclusive 0-based) |
start_col | number | Yes | Start column index (0-based; A=0) |
end_col | number | Yes | End column index (exclusive 0-based) |
bold | boolean | No | Make text bold |
italic | boolean | No | Make text italic |
underline | boolean | No | Underline text |
strikethrough | boolean | No | Strikethrough text |
font_size | number | No | Font size in points |
font_family | string | No | Font family (e.g. Arial, Roboto, Courier New) |
font_color | string | No | Font color as hex (e.g. #FFFFFF) |
background_color | string | No | Cell background color as hex |
h_align | string | No | Horizontal alignment: LEFT, CENTER, or RIGHT |
v_align | string | No | Vertical alignment: TOP, MIDDLE, or BOTTOM |
number_format | string | No | Number format pattern (e.g. #,##0.00, 0.0%, $#,##0.00, yyyy-mm-dd) |
wrap_strategy | string | No | Text wrap: OVERFLOW_CELL, CLIP, or WRAP |
borders | string | No | Border style: SOLID, DASHED, DOTTED, or SOLID_MEDIUM (applies to all four sides) |
border_color | string | No | Border color as hex (default: #000000) |
padding | number | No | Cell padding in pixels (applied to all sides) |
Returns: A confirmation message naming the formatted row/column range. Returns an error if no formatting options are specified.
sheets_auto_resize
Auto-resize columns to fit content.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_col | number | Yes | Start column index (0-based) |
end_col | number | Yes | End column index (exclusive) |
Returns: A confirmation message naming the resized column range.
sheets_set_column_width
Set a fixed pixel width for a range of columns.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_col | number | Yes | Start column index (0-based) |
end_col | number | Yes | End column index (exclusive) |
pixel_size | number | Yes | Column width in pixels |
Returns: A confirmation message naming the column range and new width.
sheets_set_row_height
Set a fixed pixel height for a range of rows.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | Start row index (0-based) |
end_row | number | Yes | End row index (exclusive) |
pixel_size | number | Yes | Row height in pixels |
Returns: A confirmation message naming the row range and new height.
sheets_merge_cells
Merge a range of cells.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | Start row (0-based) |
end_row | number | Yes | End row (exclusive) |
start_col | number | Yes | Start column (0-based) |
end_col | number | Yes | End column (exclusive) |
merge_type | string | No | MERGE_ALL (default), MERGE_COLUMNS, or MERGE_ROWS |
Returns: A confirmation message naming the merged row/column range.
sheets_unmerge_cells
Unmerge previously merged cells.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | Start row (0-based) |
end_row | number | Yes | End row (exclusive) |
start_col | number | Yes | Start column (0-based) |
end_col | number | Yes | End column (exclusive) |
Returns: A confirmation message naming the unmerged row/column range.
sheets_conditional_format
Add conditional formatting rules or color scale heatmaps.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | Start row (0-based) |
end_row | number | Yes | End row (exclusive) |
start_col | number | Yes | Start column (0-based) |
end_col | number | Yes | End column (exclusive) |
rule_type | string | Yes | NUMBER_GREATER, NUMBER_LESS, NUMBER_BETWEEN, TEXT_CONTAINS, CUSTOM_FORMULA, COLOR_SCALE |
values | array of strings | No | Comparison values. NUMBER_GREATER/LESS: [value]. NUMBER_BETWEEN: [min, max]. TEXT_CONTAINS: [text]. CUSTOM_FORMULA: [formula]. |
background_color | string | No | Background color when condition is true (hex) |
font_color | string | No | Font color when condition is true (hex) |
min_color | string | No | COLOR_SCALE: min color (hex) |
mid_color | string | No | COLOR_SCALE: midpoint color (hex) |
max_color | string | No | COLOR_SCALE: max color (hex) |
Returns: A confirmation message naming the rule type and the affected row/column range.
sheets_clear_conditional_format
Delete a conditional formatting rule by its index.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
rule_index | number | Yes | 0-based index of the conditional format rule to delete |
Returns: A confirmation message naming the deleted rule index and sheet ID.
sheets_set_borders
Set individual border styles (top/bottom/left/right/inner) independently on a range.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | Start row (0-based) |
end_row | number | Yes | End row (exclusive) |
start_col | number | Yes | Start column (0-based) |
end_col | number | Yes | End column (exclusive) |
top | string | No | Top border style: SOLID, DASHED, DOTTED, SOLID_MEDIUM, SOLID_THICK, DOUBLE, or NONE |
bottom | string | No | Bottom border style |
left | string | No | Left border style |
right | string | No | Right border style |
inner_horizontal | string | No | Inner horizontal border style |
inner_vertical | string | No | Inner vertical border style |
color | string | No | Border color as hex (default: #000000) |
Returns: A confirmation message naming the bordered row/column range. Returns an error if no border side is specified.
sheets_set_text_rotation
Rotate cell text at an angle or stack vertically.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | Start row (0-based) |
end_row | number | Yes | End row (exclusive) |
start_col | number | Yes | Start column (0-based) |
end_col | number | Yes | End column (exclusive) |
angle | number | Yes | Rotation angle in degrees (-90 to 90). Use 90 for vertical text. |
vertical | boolean | No | Set to true for stacked vertical text instead of angled |
Returns: A confirmation message naming the affected row/column range.
sheets_freeze
Freeze rows and/or columns (header pinning).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
frozen_rows | number | No | Number of rows to freeze (0 = none) |
frozen_cols | number | No | Number of columns to freeze (0 = none) |
Returns: A confirmation message naming the number of rows/columns frozen and the sheet ID.
sheets_unfreeze
Remove all row/column freezing from a sheet.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
Returns: A confirmation message naming the sheet ID.
sheets_hide_rows
Hide a range of rows.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | Start row index (0-based) |
end_row | number | Yes | End row index (exclusive) |
Returns: A confirmation message naming the hidden row range.
sheets_hide_columns
Hide a range of columns.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_col | number | Yes | Start column index (0-based) |
end_col | number | Yes | End column index (exclusive) |
Returns: A confirmation message naming the hidden column range (as letters).
sheets_unhide_rows
Unhide a range of rows.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | Start row index (0-based) |
end_row | number | Yes | End row index (exclusive) |
Returns: A confirmation message naming the unhidden row range.
sheets_unhide_columns
Unhide a range of columns.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_col | number | Yes | Start column index (0-based) |
end_col | number | Yes | End column index (exclusive) |
Returns: A confirmation message naming the unhidden column range (as letters).
sheets_set_tab_color
Change the color of a sheet tab.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
color | string | Yes | Tab color as hex (e.g. #FF0000) |
Returns: A confirmation message naming the new tab color and sheet ID.
Named ranges
sheets_add_named_range
Create a named range so formulas can reference it by name (e.g. =SUM(SalesData)).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
name | string | Yes | Name for the range (e.g. SalesData) |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | Start row (0-based) |
end_row | number | Yes | End row (exclusive) |
start_col | number | Yes | Start column (0-based) |
end_col | number | Yes | End column (exclusive) |
Returns: A confirmation message with the new named range's name and ID.
sheets_delete_named_range
Delete a named range by its ID.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
named_range_id | string | Yes | Named range ID (from sheets_list_named_ranges) |
Returns: A confirmation message naming the deleted named range ID.
sheets_list_named_ranges
List all named ranges in the spreadsheet with their IDs and cell ranges.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
Returns: A list of named ranges with their IDs and row/column extents, or "No named ranges found.".
Data validation
sheets_add_data_validation
Add data validation (dropdowns, number ranges, date constraints, custom formulas) to a range.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | Start row (0-based) |
end_row | number | Yes | End row (exclusive) |
start_col | number | Yes | Start column (0-based) |
end_col | number | Yes | End column (exclusive) |
condition_type | string | Yes | ONE_OF_LIST, ONE_OF_RANGE, NUMBER_BETWEEN, NUMBER_GREATER, NUMBER_LESS, TEXT_CONTAINS, DATE_BEFORE, DATE_AFTER, CUSTOM_FORMULA |
values | array of strings | No | Values for the condition (dropdown items, range, formula, etc.) |
show_dropdown | boolean | No | Show a dropdown UI for ONE_OF_LIST |
input_message | string | No | Help text shown when cell is selected |
strict | boolean | No | Reject invalid input (true) vs. just warn (false) |
Returns: A confirmation message naming the condition type and affected row/column range.
sheets_clear_data_validation
Remove data validation rules from a range.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | Start row (0-based) |
end_row | number | Yes | End row (exclusive) |
start_col | number | Yes | Start column (0-based) |
end_col | number | Yes | End column (exclusive) |
Returns: A confirmation message naming the cleared row/column range.
Filters & sorting
sheets_set_basic_filter
Enable the basic auto-filter on a range (adds the dropdown arrows in the header row).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | Start row (0-based) |
end_row | number | Yes | End row (exclusive) |
start_col | number | Yes | Start column (0-based) |
end_col | number | Yes | End column (exclusive) |
Returns: A confirmation message naming the filtered row/column range.
sheets_clear_basic_filter
Remove the basic auto-filter from a sheet.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
Returns: A confirmation message naming the sheet ID.
sheets_add_filter_view
Create a saved filter view (named filters that can be toggled without affecting other viewers).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
title | string | Yes | Name for the filter view |
start_row | number | Yes | Start row (0-based) |
end_row | number | Yes | End row (exclusive) |
start_col | number | Yes | Start column (0-based) |
end_col | number | Yes | End column (exclusive) |
Returns: A confirmation message with the filter view's title and ID.
sheets_delete_filter_view
Delete a saved filter view by ID.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
filter_view_id | number | Yes | Filter view ID to delete |
Returns: A confirmation message naming the deleted filter view ID.
sheets_sort_range
Sort a range of rows by a specific column.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | Start row (0-based) |
end_row | number | Yes | End row (exclusive) |
start_col | number | Yes | Start column (0-based) |
end_col | number | Yes | End column (exclusive) |
sort_col_index | number | Yes | 0-based column index to sort by (relative to start_col) |
ascending | boolean | Yes | true for ascending (A-Z / 0-9), false for descending |
Returns: A confirmation message naming the sorted row range, sort column, and order.
Pivot tables
sheets_create_pivot_table
Create a pivot table summarizing source data with row/column groupings and value aggregation.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
source_sheet_id | number | Yes | Sheet ID containing source data |
source_start_row | number | Yes | Source data start row (0-based) |
source_end_row | number | Yes | Source data end row (exclusive) |
source_start_col | number | Yes | Source data start column (0-based) |
source_end_col | number | Yes | Source data end column (exclusive) |
dest_sheet_id | number | Yes | Sheet ID to place the pivot table |
dest_row | number | Yes | Row to anchor pivot table (0-based) |
dest_col | number | Yes | Column to anchor pivot table (0-based) |
row_group_cols | array of numbers | Yes | 0-based source column indices to use as row groups |
col_group_cols | array of numbers | No | 0-based source column indices to use as column groups |
value_col | number | Yes | 0-based source column index to aggregate |
value_function | string | No | Aggregation: SUM, COUNT, AVERAGE, MAX, MIN, COUNTA (default: SUM) |
Returns: A confirmation message describing the pivot table's location and aggregation.
Charts
sheets_create_chart
Create an embedded chart from spreadsheet data. Supports bar, column, line, area, scatter, pie, combo, histogram, candlestick, waterfall, and treemap.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID where data lives |
chart_type | string | Yes | BAR, COLUMN, LINE, AREA, SCATTER, PIE, COMBO, STEPPED_AREA, CANDLESTICK, HISTOGRAM, WATERFALL, TREEMAP |
title | string | No | Chart title |
subtitle | string | No | Chart subtitle |
data_start_row | number | Yes | Start row of data (0-based inclusive) |
data_end_row | number | Yes | End row of data (0-based exclusive) |
data_start_col | number | Yes | Start column (0-based) — used as the chart's domain/category axis |
data_end_col | number | Yes | End column (0-based exclusive) — remaining columns become data series |
header_count | number | No | Number of header rows (default: 1) |
position_row | number | No | Row to anchor the chart (0-based) |
position_col | number | No | Column to anchor the chart (0-based, default: just past data_end_col) |
width_pixels | number | No | Chart width in pixels (default: 600) |
height_pixels | number | No | Chart height in pixels (default: 371) |
stacked | boolean | No | Stack series (BAR/COLUMN/AREA) |
legend_position | string | No | BOTTOM_LEGEND, TOP_LEGEND, LEFT_LEGEND, RIGHT_LEGEND, NO_LEGEND (default: BOTTOM_LEGEND) |
Returns: A confirmation message with the chart type, title, and new chart ID.
sheets_delete_chart
Delete an embedded chart by its ID.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
chart_id | number | Yes | Chart ID to delete (from sheets_create_chart or sheets_list_charts) |
Returns: A confirmation message naming the deleted chart ID.
sheets_list_charts
List all embedded charts in the spreadsheet with their IDs, types, and titles.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
Returns: A list of chartId=<id> title="<title>" lines, or "No charts found.".
Protection
sheets_protect_range
Protect a range from edits. Can be warning-only or strictly locked to specific editors.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
start_row | number | Yes | Start row (0-based) |
end_row | number | Yes | End row (exclusive) |
start_col | number | Yes | Start column (0-based) |
end_col | number | Yes | End column (exclusive) |
description | string | No | Description of why this range is protected |
warning_only | boolean | No | Show warning but still allow edits |
editor_emails | array of strings | No | Email addresses allowed to edit (used only when warning_only is false) |
Returns: A confirmation message naming the protected row/column range and the new protected range ID.
sheets_protect_sheet
Protect an entire sheet tab from edits.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID to protect |
description | string | No | Description |
warning_only | boolean | No | Warning only mode |
editor_emails | array of strings | No | Emails allowed to edit (used only when warning_only is false) |
Returns: A confirmation message naming the protected sheet ID and the new protected range ID.
sheets_remove_protection
Remove a protection rule by its ID.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
protected_range_id | number | Yes | Protected range ID to remove (from sheets_list_protections) |
Returns: A confirmation message naming the removed protection ID.
sheets_list_protections
List all protection rules (ranges and sheets) in the spreadsheet.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
Returns: A list of id=<id> desc="<description>" warningOnly=<bool> lines, or "No protections found.".
Notes & comments
sheets_add_note
Add or update a cell note (comment) at a specific cell.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
row | number | Yes | Row index (0-based) |
col | number | Yes | Column index (0-based) |
note | string | Yes | Note text content |
Returns: A confirmation message naming the cell reference (e.g. B3).
sheets_clear_note
Remove the note from a specific cell.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
sheet_id | number | Yes | Numeric sheet ID |
row | number | Yes | Row index (0-based) |
col | number | Yes | Column index (0-based) |
Returns: A confirmation message naming the cell reference the note was cleared from.
Developer metadata
sheets_add_developer_metadata
Attach key-value developer metadata to the spreadsheet (useful for tagging with external IDs).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
key | string | Yes | Metadata key |
value | string | Yes | Metadata value |
visibility | string | No | DOCUMENT or PROJECT (default: DOCUMENT) |
Returns: A confirmation message with the key, value, and new metadata ID.
sheets_get_developer_metadata
Retrieve developer metadata entries matching a key.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
key | string | Yes | Metadata key to look up |
Returns: A list of id=<id> key="<key>" value="<value>" lines, or "No metadata found for key=\"<key>\"".
Spreadsheet settings
sheets_update_spreadsheet_properties
Update spreadsheet-level settings: title, locale, timezone, default number format.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
title | string | No | New spreadsheet title |
locale | string | No | Locale code (e.g. en_US, fr_FR) |
time_zone | string | No | Time zone (e.g. America/New_York) |
default_number_format | string | No | Default number format pattern for new cells |
Returns: A confirmation message listing the updated property names. Returns an error if no properties are provided.
sheets_set_iterative_calculation
Enable/disable iterative calculation for circular references, and set max iterations and convergence threshold.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
enable_iteration | boolean | Yes | true to enable iterative calculation (for circular references) |
max_iterations | number | No | Max iteration count (default: 100) |
convergence_threshold | number | No | Stop iterating when change is smaller than this (default: 0.001) |
Returns: A confirmation message stating whether iterative calculation is enabled.
Raw batch update (escape hatch)
sheets_batch_update
Execute raw batchUpdate requests for any advanced operation not covered by other tools.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
spreadsheet_id | string | Yes | Spreadsheet ID |
requests_json | string | Yes | JSON array of Sheets API batchUpdate request objects |
Returns: A confirmation message with the number of requests executed. Returns an error if requests_json is not valid JSON.