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)
{
"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
| Name | Type | Description |
|---|---|---|
spreadsheet_idrequired | string | the spreadsheet ID (from its URL or get_sheet_metadata). |
data_rangerequired | string | A1 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_typerequired | string | BAR, COLUMN, LINE, AREA, SCATTER, COMBO, or PIE. |
title | string | Chart title.Default: "" |
anchor_range | string | Single-cell A1 for the chart anchor (e.g. 'Competitors!H3'). Omit to place just to the right of data_range. |
width_pixels | integer | chart size in pixels, default 600 × 371.Default: 600 |
height_pixels | integer | chart size in pixels, default 600 × 371.Default: 371 |
legend_position | string | BOTTOM_LEGEND / LEFT_LEGEND / RIGHT_LEGEND / TOP_LEGEND / NO_LEGEND.Default: "BOTTOM_LEGEND" |
x_axis_title | string | Axis labels.Default: "" |
y_axis_title | string | Axis labels.Default: "" |
stacked_type | string | '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',
)