Skip to main content
Glama
marekrost

mcp-server-spreadsheet

create_workbook_file

Create new spreadsheet files in XLSX, CSV, or ODS format at specified paths for organizing data with customizable sheet names.

Instructions

Create a new empty spreadsheet file at the given path.

The file format is determined by the extension (.xlsx, .csv, or .ods). The file must not already exist. Returns the absolute path of the created file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesPath where the new file will be created (.csv, .ods, .xlsx). Must not already exist.
sheet_nameNoName for the initial sheet. Defaults to 'Sheet' for xlsx/ods, 'default' for csv.

Implementation Reference

  • The `create_workbook_file` tool creates an empty spreadsheet file at a specified path, supporting .xlsx, .csv, and .ods formats. It validates that the file does not already exist, initializes the workbook, and saves it.
    def create_workbook_file(
        file: Annotated[str, Field(description=f"Path where the new file will be created ({_EXT_LABEL}). Must not already exist.")],
        sheet_name: Annotated[str | None, Field(description="Name for the initial sheet. Defaults to 'Sheet' for xlsx/ods, 'default' for csv.")] = None,
    ) -> str:
        """Create a new empty spreadsheet file at the given path.
    
        The file format is determined by the extension (.xlsx, .csv, or .ods).
        The file must not already exist. Returns the absolute path of the
        created file.
        """
        p = Path(file)
        if p.exists():
            raise ValueError(f"File already exists: {file}")
        wb = create_workbook(file, sheet_name)
        wb.save(file)
        return str(p.resolve())

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