Skip to main content
Glama
marekrost

mcp-server-spreadsheet

append_rows

Add new rows to the end of a spreadsheet sheet. Use this tool to efficiently append data like [['Alice', 30], ['Bob', 25]] after the last used row.

Instructions

Append one or more rows after the last used row in the sheet.

Values are type-coerced (numeric strings to numbers). This is the most efficient way to add data to the end of a sheet.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesPath to the spreadsheet file
dataYesList of rows to append, e.g. [['Alice', 30], ['Bob', 25]]. Each inner list is one row.
sheetNoSheet name. Defaults to the first sheet if omitted.

Implementation Reference

  • The implementation of the `append_rows` tool, which uses `@mcp.tool()` to register it and handles appending rows to a spreadsheet.
    @mcp.tool()
    def append_rows(
        file: Annotated[str, Field(description="Path to the spreadsheet file")],
        data: Annotated[list[list], Field(description="List of rows to append, e.g. [['Alice', 30], ['Bob', 25]]. Each inner list is one row.")],
        sheet: Annotated[str | None, Field(description="Sheet name. Defaults to the first sheet if omitted.")] = None,
    ) -> str:
        """Append one or more rows after the last used row in the sheet.
    
        Values are type-coerced (numeric strings to numbers).
        This is the most efficient way to add data to the end of a sheet.
        """
        wb = load_workbook(file)
        ws = _resolve_sheet(wb, sheet)
        for row in data:
            ws.append([coerce_value(v) for v in row])
        wb.save(file)
        return f"Appended {len(data)} rows"

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