Skip to main content
Glama
marekrost

mcp-server-spreadsheet

write_range

Write a 2D array of values into a spreadsheet region starting from a specified cell, replacing multiple individual cell writes with a single efficient operation.

Instructions

Write a 2D array of values into a rectangular region.

Writing starts at start_cell and expands right and down to fit the data. Prefer this over multiple write_cell calls for efficiency.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesPath to the spreadsheet file
start_cellYesTop-left cell where writing begins, e.g. 'B2'
dataYes2D array of values (list of rows), e.g. [[1, 2, 3], ['a', 'b', 'c']]. Numeric strings are coerced to numbers.
sheetNoSheet name. Defaults to the first sheet if omitted.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Implementation of the write_range MCP tool which writes a 2D array of values into a spreadsheet at a specified starting cell.
    def write_range(
        file: Annotated[str, Field(description="Path to the spreadsheet file")],
        start_cell: Annotated[str, Field(description="Top-left cell where writing begins, e.g. 'B2'")],
        data: Annotated[list[list], Field(description="2D array of values (list of rows), e.g. [[1, 2, 3], ['a', 'b', 'c']]. Numeric strings are coerced to numbers.")],
        sheet: Annotated[str | None, Field(description="Sheet name. Defaults to the first sheet if omitted.")] = None,
    ) -> str:
        """Write a 2D array of values into a rectangular region.
    
        Writing starts at start_cell and expands right and down to fit the
        data. Prefer this over multiple write_cell calls for efficiency.
        """
        wb = load_workbook(file)
        ws = _resolve_sheet(wb, sheet)
        row_off, col_off = parse_cell(start_cell)
        for r_idx, row in enumerate(data):
            for c_idx, val in enumerate(row):
                ws.set_cell(row_off + r_idx, col_off + c_idx, coerce_value(val))
        wb.save(file)
        return f"Wrote {len(data)} rows starting at {start_cell}"
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It mentions the tool is more efficient than multiple write_cell calls, which is useful behavioral context. However, it doesn't disclose critical details like whether this operation overwrites existing data, requires specific permissions, or has rate limits, leaving gaps for a mutation tool.

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

Conciseness5/5

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

The description is front-loaded with the core purpose in the first sentence, followed by essential usage guidance. Both sentences earn their place by clarifying the tool's behavior and efficiency advantage, with zero wasted words.

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

Completeness4/5

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

Given that there's an output schema (which handles return values), no annotations, and high schema coverage, the description is reasonably complete. It covers the core purpose and efficiency context well, though it could better address behavioral aspects like data overwriting or error conditions for a write operation.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema by mentioning the rectangular region expansion from start_cell, but doesn't provide additional syntax or format details. This meets the baseline for high schema coverage.

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 clearly states the specific action ('Write a 2D array of values into a rectangular region') and distinguishes it from sibling tools by explicitly mentioning 'Prefer this over multiple write_cell calls for efficiency.' It identifies both the verb (write) and resource (spreadsheet region) with precision.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool ('Prefer this over multiple write_cell calls for efficiency') and implicitly suggests alternatives (write_cell). It also clarifies the scope by stating it writes to a 'rectangular region' starting at a specific cell, which helps differentiate it from other writing tools like append_rows.

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/marekrost/mcp-server-spreadsheet'

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