Skip to main content
Glama
marekrost

mcp-server-spreadsheet

write_cell

Write a value to a specific spreadsheet cell, automatically converting numeric strings to numbers and text to strings.

Instructions

Write a single value to a cell.

Overwrites any existing value. The value is type-coerced: numeric strings become numbers, all else is text.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesPath to the spreadsheet file
cellYesTarget cell in A1 notation, e.g. 'B3'
valueYesValue to write. Numeric strings are coerced to numbers, everything else is stored as text.
sheetNoSheet name. Defaults to the first sheet if omitted.

Implementation Reference

  • The implementation of the write_cell tool, which updates a specific cell in a spreadsheet file.
    def write_cell(
        file: Annotated[str, Field(description="Path to the spreadsheet file")],
        cell: Annotated[str, Field(description="Target cell in A1 notation, e.g. 'B3'")],
        value: Annotated[object, Field(description="Value to write. Numeric strings are coerced to numbers, everything else is stored as text.")],
        sheet: Annotated[str | None, Field(description="Sheet name. Defaults to the first sheet if omitted.")] = None,
    ) -> str:
        """Write a single value to a cell.
    
        Overwrites any existing value. The value is type-coerced: numeric
        strings become numbers, all else is text.
        """
        wb = load_workbook(file)
        ws = _resolve_sheet(wb, sheet)
        row, col = parse_cell(cell)
        ws.set_cell(row, col, coerce_value(value))
        wb.save(file)
        return f"Wrote to {cell}"
  • Registration of the write_cell tool using the @mcp.tool() decorator.
    @mcp.tool()

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