Skip to main content
Glama
marekrost

mcp-server-spreadsheet

get_sheet_dimensions

Retrieve the row and column count of data in a spreadsheet sheet to determine its size and structure for processing or analysis.

Instructions

Get the dimensions of the used range in a sheet.

Returns {"rows": N, "columns": M} where N is the number of the last used row and M is the number of the last used column. Both are 0 for an empty sheet.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesPath to the spreadsheet file
sheetNoSheet name. Defaults to the first sheet if omitted.

Implementation Reference

  • Implementation of the 'get_sheet_dimensions' tool, which uses 'load_workbook' and '_resolve_sheet' helpers to retrieve dimensions from the SpreadsheetSheet object.
    def get_sheet_dimensions(
        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,
    ) -> dict:
        """Get the dimensions of the used range in a sheet.
    
        Returns {"rows": N, "columns": M} where N is the number of the last
        used row and M is the number of the last used column. Both are 0 for
        an empty sheet.
        """
        wb = load_workbook(file)
        ws = _resolve_sheet(wb, sheet)
        return {
            "rows": ws.max_row,
            "columns": ws.max_column,
        }

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