files_run
Sets a code cell at the given position and runs it in a sandboxed cloud worker, writing its result back into the spreadsheet. Prefer files_set_formula whenever a formula can accomplish the task; only use code when the functionality is not available in formulas (charts, machine learning, complex transforms, web/API requests). Requires edit permission. language='python' (pandas/numpy) runs code; language='connection' runs an SQL query against a database connection (pass connection_uuid from connections_list; 'code' is the SQL) and lands the result table at the cell. Execution is ASYNCHRONOUS: returns a task id immediately; read the cell with files_read after a few seconds. Signature: files_run(file_uuid, cell, language, code, sheet?, connection_uuid?).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"file_uuid": "<file_uuid>",
"cell": "<cell>",
"language": "<language>",
"code": "<code>"
},
"name": "files_run"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cell | Yes | Anchor cell of the code cell in A1 notation, e.g. 'A1'. | |
| code | Yes | Python source, or the SQL query when language='connection'. | |
| sheet | No | Sheet name (defaults to the first sheet). | |
| language | Yes | ||
| file_uuid | Yes | ||
| connection_uuid | No | Required when language='connection': the database connection UUID (from connections_list) to run the SQL against. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cell | Yes | ||
| note | Yes | ||
| status | Yes | ||
| task_id | Yes | ||
| file_uuid | Yes |