Skip to main content
Glama
marekrost

mcp-server-spreadsheet

delete_columns

Remove specified columns from spreadsheet files to clean data or restructure layouts, shifting remaining columns left automatically.

Instructions

Delete one or more columns, shifting remaining columns left.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesPath to the spreadsheet file
columnYes1-based index of the first column to delete (e.g. 1 = A, 2 = B)
countNoNumber of consecutive columns to delete starting from column
sheetNoSheet name. Defaults to the first sheet if omitted.

Implementation Reference

  • The delete_columns tool implementation, which loads the spreadsheet, resolves the sheet, deletes the specified range of columns, saves the file, and returns a confirmation message.
    @mcp.tool()
    def delete_columns(
        file: Annotated[str, Field(description="Path to the spreadsheet file")],
        column: Annotated[int, Field(description="1-based index of the first column to delete (e.g. 1 = A, 2 = B)")],
        count: Annotated[int, Field(description="Number of consecutive columns to delete starting from column")] = 1,
        sheet: Annotated[str | None, Field(description="Sheet name. Defaults to the first sheet if omitted.")] = None,
    ) -> str:
        """Delete one or more columns, shifting remaining columns left."""
        wb = load_workbook(file)
        ws = _resolve_sheet(wb, sheet)
        ws.delete_cols(column, count)
        wb.save(file)
        return f"Deleted {count} columns at column {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