chart_insert
Insert a chart linked to spreadsheet ranges so it updates automatically when source cells change. Define series, categories, chart type, and placement to visualize data directly in the sheet.
Instructions
Insert a chart that reads its values live from the given ranges — editing those cells later updates the chart.
Look at the data first so the series are right: a column of labels belongs in categoriesRef, each column of numbers is one series, and its header is that series' name.
References are A1 (B2:B10, or Sheet2!B2:B10 to read another sheet). The chart is placed below the data unless anchor says otherwise.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | Chart title. | |
| anchor | No | Top-left cell of the chart, e.g. 'H2'. Defaults to two rows below the data. | |
| series | Yes | One entry per data series. Each valueRef is an A1 range of the values to plot. | |
| sheetIdx | Yes | Sheet the chart is placed on (zero-based). | |
| chartType | Yes | col = vertical bars, bar = horizontal. pie/doughnut plot one series. scatter/bubble take numeric X from categoriesRef. stock needs 4 series (open/high/low/close) or 3 (high/low/close). surface plots a grid, one series per row. | |
| sizeInCells | No | Chart size in cells. Defaults to 15 × 8. | |
| categoriesRef | No | A1 range of the category labels (the X axis), e.g. A2:A10. For scatter/bubble these are the numeric X values. |