Skip to main content
Glama
josedu90

MCP Google Workspace Server

sheets_create

Generate a new Google Sheet with customizable titles and sheet names using the MCP Google Workspace Server, enabling efficient spreadsheet creation via AI-driven commands.

Instructions

Create a new Google Sheet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sheetsNoSheet names
titleYesTitle of the spreadsheet

Implementation Reference

  • The tool handler function _handle_sheets_create that processes the tool call arguments and delegates to SheetsService.create_spreadsheet method.
    async def _handle_sheets_create(
        self, context: GoogleWorkspaceContext, arguments: dict
    ) -> Dict[str, Any]:
        """Handle sheets create requests."""
        title = arguments.get("title")
        sheets = arguments.get("sheets", [])
    
        if not title:
            raise ValueError("Spreadsheet title is required")
    
        logger.debug(f"Creating spreadsheet - Title: {title}, Sheets: {sheets}")
        result = await context.sheets.create_spreadsheet(title=title, sheets=sheets)
        logger.debug(f"Spreadsheet created - ID: {result.get('spreadsheetId')}")
        return result
  • Input schema definition for the sheets_create tool within the _get_tools_list method.
    types.Tool(
        name="sheets_create",
        description="Create a new Google Sheet",
        inputSchema={
            "type": "object",
            "properties": {
                "title": {"type": "string", "description": "Title of the spreadsheet"},
                "sheets": {
                    "type": "array",
                    "items": {"type": "string"},
                    "description": "Sheet names",
                },
            },
            "required": ["title"],
        },
    ),
  • Core implementation of spreadsheet creation using Google Sheets API v4 in SheetsService class, called by the handler.
    def create_spreadsheet(self, title: str, sheets: Optional[List[str]] = None) -> Dict[str, Any]:
        """Create a new Google Spreadsheet with optional sheets."""
        try:
            spreadsheet_body = {"properties": {"title": title}}
    
            if sheets:
                spreadsheet_body["sheets"] = [
                    {"properties": {"title": sheet_name}} for sheet_name in sheets
                ]
    
            spreadsheet = self.service.spreadsheets().create(body=spreadsheet_body).execute()
    
            return {"success": True, "spreadsheet": spreadsheet}
        except HttpError as error:
            return {"success": False, **self.handle_error(error)}
Install Server

Other Tools

Related Tools

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/josedu90/mcp-suiteg'

If you have feedback or need assistance with the MCP directory API, please join our Discord server