Skip to main content
Glama
marekrost

mcp-server-spreadsheet

read_sheet

Extract spreadsheet data as structured rows, with optional bounds to limit output for large sheets. Returns cell values with empty cells as null.

Instructions

Read an entire sheet (or a bounded sub-region) as a list of rows.

Each row is a list of cell values. Empty cells appear as null. Use the optional row/column bounds to limit output for large sheets.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesPath to the spreadsheet file
sheetNoSheet name. Defaults to the first sheet if omitted.
start_rowNoFirst row to include (1-based). Defaults to the first used row.
end_rowNoLast row to include (1-based). Defaults to the last used row.
start_columnNoFirst column to include (1-based, e.g. 1 = A). Defaults to the first used column.
end_columnNoLast column to include (1-based). Defaults to the last used column.

Implementation Reference

  • The implementation of the `read_sheet` MCP tool, which reads an entire sheet or a sub-region into a 2D list.
    def read_sheet(
        file: Annotated[str, Field(description="Path to the spreadsheet file")],
        sheet: Annotated[str | None, Field(description="Sheet name. Defaults to the first sheet if omitted.")] = None,
        start_row: Annotated[int | None, Field(description="First row to include (1-based). Defaults to the first used row.")] = None,
        end_row: Annotated[int | None, Field(description="Last row to include (1-based). Defaults to the last used row.")] = None,
        start_column: Annotated[int | None, Field(description="First column to include (1-based, e.g. 1 = A). Defaults to the first used column.")] = None,
        end_column: Annotated[int | None, Field(description="Last column to include (1-based). Defaults to the last used column.")] = None,
    ) -> list[list]:
        """Read an entire sheet (or a bounded sub-region) as a list of rows.
    
        Each row is a list of cell values. Empty cells appear as null.
        Use the optional row/column bounds to limit output for large sheets.
        """
        wb = load_workbook(file)
        ws = _resolve_sheet(wb, sheet)
        rows = ws.iter_rows(
            min_row=start_row,
            max_row=end_row,
            min_col=start_column,
            max_col=end_column,
        )
        return [list(r) for r in 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