KosmoKrator

productivity

Google Sheets MCP Integration for LangChain

Connect Google Sheets to LangChain through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.

20 functions 13 read 7 write OAuth browser flow auth

Connect Google Sheets to LangChain

Bridge LangChain agents to local KosmoKrator integration tools through MCP or headless CLI calls.

Use the MCP gateway when the agent should discover tools, or wrap kosmo integrations:call for fixed chains. The gateway is local, scoped to this integration, and starts with --write=deny so LangChain can inspect read-capable tools without receiving write access by default.

Google Sheets MCP Config for LangChain

Keep the gateway scoped to the integration and operation class needed by the chain.

{
  "mcpServers": {
    "kosmokrator-google_sheets": {
      "type": "stdio",
      "command": "kosmo",
      "args": [
        "mcp:serve",
        "--integration=google_sheets",
        "--write=deny"
      ]
    }
  }
}

Run the Gateway Manually

kosmokrator mcp:serve --integration=google_sheets --write=deny

Why Use KosmoKrator Here

Scoped tools

Expose only Google Sheets instead of a broad multi-service tool list.

Local credentials

Reuse credentials already configured for the KosmoKrator CLI and Lua runtime.

Write policy

Start read-only, then opt into ask or allow for trusted workspaces.

Google Sheets Tools Visible to LangChain

LangChain sees stable MCP tool names generated from the Google Sheets integration catalog.

MCP toolSource functionTypeDescription
integration__google_sheets__google_sheets_add_filter google_sheets.google_sheets_add_filter Write Apply filter dropdowns to a range in a Google Sheets sheet/tab.
integration__google_sheets__google_sheets_add_sheet google_sheets.google_sheets_add_sheet Write Add a new sheet/tab to a Google Spreadsheet.
integration__google_sheets__google_sheets_append google_sheets.google_sheets_append Read Append rows after the last data row in a Google Spreadsheet. Auto-detects the table boundary. Provide the range (e.g., "Sheet1" or "Sheet1!A:D") and a 2D array of rows to append.
integration__google_sheets__google_sheets_batch_read google_sheets.google_sheets_batch_read Read Read multiple ranges from a Google Spreadsheet in one call. Provide an array of A1 notation ranges (e.g., ["Sheet1!A1:B5", "Sheet2!C1:D10"]). Returns results keyed by range.
integration__google_sheets__google_sheets_batch_write google_sheets.google_sheets_batch_write Read Write to multiple ranges in a Google Spreadsheet in one call. Provide an array of {range, values} objects to update several areas at once.
integration__google_sheets__google_sheets_clear google_sheets.google_sheets_clear Read Clear all values from a Google Sheets range (keeps formatting intact). Specify the range in A1 notation.
integration__google_sheets__google_sheets_create google_sheets.google_sheets_create Read Create a new empty Google Spreadsheet with a given title. Returns the new spreadsheet ID and URL.
integration__google_sheets__google_sheets_delete_columns google_sheets.google_sheets_delete_columns Write Delete columns from a Google Sheets sheet/tab. Uses 0-based indexing.
integration__google_sheets__google_sheets_delete_rows google_sheets.google_sheets_delete_rows Write Delete rows from a Google Sheets sheet/tab. Uses 0-based indexing.
integration__google_sheets__google_sheets_delete_sheet google_sheets.google_sheets_delete_sheet Write Delete a sheet/tab from a Google Spreadsheet.
integration__google_sheets__google_sheets_duplicate_sheet google_sheets.google_sheets_duplicate_sheet Write Copy a sheet/tab within the same Google Spreadsheet.
integration__google_sheets__google_sheets_find google_sheets.google_sheets_find Read Search for text within a Google Spreadsheet. Searches all sheets by default, or specify a sheet name to narrow the search. Returns match count and number of sheets containing matches.
integration__google_sheets__google_sheets_get_metadata google_sheets.google_sheets_get_metadata Read Get spreadsheet title and list of sheets/tabs with their names, IDs, and dimensions. Use this first to discover sheet names and structure before reading or writing data.
integration__google_sheets__google_sheets_insert_columns google_sheets.google_sheets_insert_columns Read Insert blank columns into a Google Sheets sheet/tab. Uses 0-based indexing.
integration__google_sheets__google_sheets_insert_rows google_sheets.google_sheets_insert_rows Read Insert blank rows into a Google Sheets sheet/tab. Uses 0-based indexing.
integration__google_sheets__google_sheets_read_range google_sheets.google_sheets_read_range Read Read cell values from a Google Sheets range using A1 notation. A1 notation examples: `Sheet1!A1:D10` (range), `Sheet1!A:A` (whole column), `Sheet1` (entire sheet). Sheet names with spaces need quotes: `'My Sheet'!A1:B2`.
integration__google_sheets__google_sheets_remove_filter google_sheets.google_sheets_remove_filter Write Remove the filter from a Google Sheets sheet/tab.
integration__google_sheets__google_sheets_rename_sheet google_sheets.google_sheets_rename_sheet Read Rename a sheet/tab in a Google Spreadsheet.
integration__google_sheets__google_sheets_sort_range google_sheets.google_sheets_sort_range Read Sort data by column(s) in a Google Sheets range.
integration__google_sheets__google_sheets_write_range google_sheets.google_sheets_write_range Read Write values to a Google Sheets range. Values format: `[["Name", "Age"], ["Alice", 30]]` — each inner array is one row. Formulas work with user_entered input mode (default): `[["=SUM(A1:A10)"]]`.

Related Google Sheets Pages