add_sheet_chart

Insert a native Google Sheets chart over a range of data.

writeGoogle Sheets, Docs & Drive

The first column of `data_range` is the domain (x-axis / labels). Remaining columns become series. For PIE the first column is labels and the second is values.

Call it

In an AI client (MCP)

tools/call
{
  "name": "add_sheet_chart",
  "arguments": {
    "spreadsheet_id": "<spreadsheet_id>",
    "data_range": "<data_range>",
    "chart_type": "<chart_type>"
  }
}

From code (Tool API)

curl -X POST https://api.sellersheetai.com/api/v1/tools/add_sheet_chart \
  -H "Authorization: Bearer $SELLERSHEET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"spreadsheet_id":"<spreadsheet_id>","data_range":"<data_range>","chart_type":"<chart_type>"}'
Early access — the Tool API is open on request, contact us.

Arguments

NameTypeDescription
spreadsheet_idrequiredstringthe spreadsheet ID (from its URL or get_sheet_metadata).
data_rangerequiredstringA1 range INCLUDING the header row, e.g. 'Competitors!B3:C18' or 'Budget!A10:D14'. At least 2 columns (labels + one series); PIE reads only the first two.
chart_typerequiredstringBAR, COLUMN, LINE, AREA, SCATTER, COMBO, or PIE.
titlestringChart title.Default: ""
anchor_rangestringSingle-cell A1 for the chart anchor (e.g. 'Competitors!H3'). Omit to place just to the right of data_range.
width_pixelsintegerchart size in pixels, default 600 × 371.Default: 600
height_pixelsintegerchart size in pixels, default 600 × 371.Default: 371
legend_positionstringBOTTOM_LEGEND / LEFT_LEGEND / RIGHT_LEGEND / TOP_LEGEND / NO_LEGEND.Default: "BOTTOM_LEGEND"
x_axis_titlestringAxis labels.Default: ""
y_axis_titlestringAxis labels.Default: ""
stacked_typestring'STACKED' or 'PERCENT_STACKED' for bar/column/area.

Result

Every tool answers {notification, data, human_action}; data carries:

  • { chartId: int, sheetId: int }

Gotchas

  • Every range here must name its tab and both ends ('Tab!A1:D10'); a range without a tab ('A1:D10') or with an open end ('Tab!A:D') is refused.

Example

add_sheet_chart(
    spreadsheet_id='1ABC...',
    data_range='Budget!A10:G14',
    chart_type='COLUMN',
    title='Monthly contribution',
    anchor_range='Budget!I10',
    stacked_type='STACKED',
)

On this page

Actions

View as Markdown

Ask an assistant

Ask ChatGPTAsk Claude