Add a column
sheet_add_columnAdd a computed column to a spreadsheet and save the result to a new file. Returns the new file path, row count, and preview of the first rows.
Instructions
Call this tool to add a computed column and save the result to a NEW file; the source is never modified unless out_path points at it. Returns the new file path, the row count and a preview of the first rows.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the new column. It must not already exist on the sheet | |
| path | Yes | Path to the source .xlsx/.xlsm/.xlsb/.ods/.csv/.tsv file (~ is expanded); it is never modified | |
| sheet | No | Sheet name; default is the first sheet | |
| values | No | Explicit values, one per data row, instead of a formula. Missing entries are left blank | |
| formula | No | Expression over the columns of each row, in the same expression language as sheet_query, e.g. "[Qty] * [Unit Price]" or '[Country] = "PL"'. Give either formula or values | |
| decimals | No | Round numeric formula results to this many decimals. Default: the widest decimal count of the columns the formula reads, capped at 2 when they all hold 2 or fewer (money in, money out); otherwise no rounding beyond float cleanup | |
| out_path | No | Output file; default <source>-plus-<column>.<same ext>. The source file is left untouched unless this points at it |