spreadsheet_idstring · requiredadd_chart
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" )
Parameters
sheetstring · requiredchart_typestring · requireddata_rangestring · requiredtitlestring · default nullx_axis_labelstring · default nully_axis_labelstring · default nullposition_xinteger · default 0position_yinteger · default 0widthinteger · default 600heightinteger · default 400