Skip to main content
Glama

write_cells

Write values, fill series, and merge or unmerge cell ranges in Excel worksheets. Choose from single-cell, range, series, merge, or unmerge modes to modify workbook data directly.

Instructions

Write data or operations to worksheet cells.

Args: mode: One of "single", "range", "series", "merge", or "unmerge". - "single": write a single cell. Requires cell_ref and value. - "range": write a 2D array starting at start_cell. Requires start_cell and data. - "series": fill a series from start_cell. Requires start_cell and count. - "merge": merge a cell range. Requires range_string. - "unmerge": unmerge a cell range. Requires range_string. file_path: Path to workbook to mutate. sheet_name: Target worksheet name. cell_ref: Single-cell reference for "single" and some formula operations. value: Value to write for single-cell writes. start_cell: Top-left cell for range/series writes. data: 2D array of values for "range" mode. series_type: Series type for "series" (e.g. "number"). count: Number of series entries to write (required for "series"). step: Increment for numeric series or string step expression. direction: "down" or "right" for series growth. start_value: Optional starting value for series. range_string: Range string for merge/unmerge (e.g. "A1:D1").

Returns: str or dict: Success message or structured result depending on operation.

Raises: ValueError: If required parameters for the chosen mode are missing or mode is unknown.

Notes: - This route mutates workbook files (destructive operations). - Dispatch mapping: "single"→tools.cell_ops.write_cell, "range"→tools.cell_ops.write_range, "series"→tools.cell_ops.fill_series, "merge"→tools.cell_ops.merge_cells, "unmerge"→tools.cell_ops.unmerge_cells. - Recommend adding short examples in the underlying tools for common series patterns.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNo
modeYes
stepNo
countNo
valueNo
cell_refNo
directionNodown
file_pathYes
sheet_nameYes
start_cellNo
series_typeNonumber
start_valueNo
range_stringNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry transparency alone. It explicitly warns 'This route mutates workbook files (destructive operations)' and documents a ValueError for missing/invalid modes. It also lists return types and dispatch mapping, but does not cover side effects like overwriting existing cell data or format preservation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (Args, Returns, Raises, Notes), but it is lengthy. It contains a developer-oriented note ('Recommend adding short examples...') that adds noise for an agent. Overall, every mode description earns its place, but the length and extraneous note reduce conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (13 parameters, 5 modes), the description is thorough. It documents required params per mode, error conditions, return shapes, and destructive behavior. The output schema exists, so return-value details are not required, and the description still offers a high-level return type.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must fully compensate. The comprehensive Args section explains every parameter, including mode-specific requirements and defaults (e.g., 'direction: "down" or "right" for series growth'). This adds substantial semantic meaning beyond the raw schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a clear verb+resource statement: 'Write data or operations to worksheet cells.' It then enumerates five distinct modes (single, range, series, merge, unmerge), which fully defines its scope. It is distinguishable from siblings like read_cells or clear_range due to the explicit writing focus.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides mode-specific guidance, stating which parameters are required for each operation (e.g., 'single' requires cell_ref and value). It also warns that the route mutates workbook files, which is relevant context. However, it does not discuss when to prefer this tool over alternatives like formula_write or write_multi_sheet.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mbeps/excel-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server