add_chart
Add a chart to a Google Spreadsheet using a specified data range, chart type, title, and optional positioning. Supports multiple chart types including column, bar, line, pie, and more.
Instructions
Add a chart to a Google Spreadsheet.
Creates a chart from the specified data range with customizable type, title, and positioning. The chart is added as a floating element on the sheet.
Args: spreadsheet_id: The ID of the spreadsheet (found in the URL) sheet: The name of the sheet containing the data chart_type: Type of chart to create. Supported types: - COLUMN: Vertical bar chart - BAR: Horizontal bar chart - LINE: Line chart - AREA: Area chart - PIE: Pie chart - SCATTER: Scatter plot - COMBO: Combination chart - HISTOGRAM: Histogram data_range: A1 notation range for chart data (e.g., 'A1:C10'). The first row is typically treated as headers. title: Optional title for the chart x_axis_label: Optional label for the X axis (bottom axis) y_axis_label: Optional label for the Y axis (left axis) position_x: Horizontal position offset in pixels from the top-left corner (default: 0) position_y: Vertical position offset in pixels from the top-left corner (default: 0) width: Width of the chart in pixels (default: 600) height: Height of the chart in pixels (default: 400)
Returns: Result of the chart creation operation
Examples: Create a column chart showing sales data: add_chart( spreadsheet_id="abc123", sheet="Sales", chart_type="COLUMN", data_range="A1:B13", title="Monthly Sales", x_axis_label="Month", y_axis_label="Revenue ($)" )
Create a pie chart for market share:
add_chart(
spreadsheet_id="abc123",
sheet="Market",
chart_type="PIE",
data_range="A1:B5",
title="Market Share by Product"
)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spreadsheet_id | Yes | ||
| sheet | Yes | ||
| chart_type | Yes | ||
| data_range | Yes | ||
| title | No | ||
| x_axis_label | No | ||
| y_axis_label | No | ||
| position_x | No | ||
| position_y | No | ||
| width | No | ||
| height | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |