excel_add_chart
Add a line, bar, column, or pie chart to a specified cell position in an Excel file using a given data range.
Instructions
Add a chart to an Excel worksheet.
Example: excel_add_chart( file_path="report.xlsx", data_range="Sheet1!A1:D8", chart_type="line", title="Growth Forecast", position="F2" )
Args: file_path: Path to the .xlsx or .xlsm file data_range: Range containing data (e.g., "A1:D10" or "Sheet1!A1:D10") chart_type: "line", "bar", "column", or "pie" sheet_name: Optional sheet name (overrides sheet in data_range) title: Optional chart title position: Top-left anchor cell for the chart (default "E2") has_header: Treat first row as header for series names use_first_column_as_categories: Use first column as category labels output_path: Optional output path (defaults to overwriting input)
Returns: Status dictionary with chart details
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Path to the .xlsx or .xlsm file | |
| data_range | Yes | Range containing data (e.g., "A1:D10" or "Sheet1!A1:D10") | |
| chart_type | No | "line", "bar", "column", or "pie" | |
| sheet_name | No | Optional sheet name (overrides sheet in data_range) | |
| title | No | Optional chart title | |
| position | No | Top-left anchor cell for the chart (default "E2") | |
| has_header | No | Treat first row as header for series names | |
| use_first_column_as_categories | No | Use first column as category labels | |
| output_path | No | Optional output path (defaults to overwriting input) |