execute_exceljs
Run Office.js code directly in an open Excel workbook to read or write ranges, formulas, tables, and charts, enabling live data access and edits through a single execution call.
Instructions
Execute arbitrary Office.js code inside the live Excel workbook. The code runs inside Excel.run(async (context) => { ... }) with 'context' available as a variable. Use 'await context.sync()' after loading properties. Return a value to get it back as the tool result. Common operations: read/write ranges (workbook.worksheets), formulas, tables, charts. Cell references use A1 notation; values/formulas are returned as arrays matching the range shape.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Office.js code to execute. Runs inside Excel.run() with 'context' available. Use 'return' to send back a result. | |
| workbookId | No | Target workbook ID from list_workbooks. Optional when only one workbook is connected. |