productivity
Google Sheets CLI for Headless Automation
Use the Google Sheets CLI for headless automation with headless JSON commands, schema discovery, credentials, and permission controls.
20 functions 13 read 7 write OAuth browser flow auth
Google Sheets CLI for Headless Automation
Use KosmoKrator as a non-interactive integration runtime for local automations and wrappers.
Use headless automation when another tool needs a stable local command surface. The Google Sheets CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Google Sheets CLI for Headless Automation
kosmokrator integrations:configure google_sheets --set access_token="$GOOGLE_SHEETS_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmo integrations:call google_sheets.google_sheets_add_filter '{"spreadsheet_id":"example_spreadsheet_id","range":"example_range"}' --json Discovery Before Execution
Agents and scripts can inspect Google Sheets docs and schemas before choosing a function.
kosmo integrations:docs google_sheets --json
kosmo integrations:docs google_sheets.google_sheets_add_filter --json
kosmo integrations:schema google_sheets.google_sheets_add_filter --json
kosmo integrations:search "Google Sheets" --json
kosmo integrations:list --json Useful Google Sheets CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
google_sheets.google_sheets_add_filter | Write | spreadsheet_id, range | Apply filter dropdowns to a range in a Google Sheets sheet/tab. |
google_sheets.google_sheets_add_sheet | Write | spreadsheet_id, title | Add a new sheet/tab to a Google Spreadsheet. |
google_sheets.google_sheets_append | Read | spreadsheet_id, range, values, input | 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. |
google_sheets.google_sheets_batch_read | Read | spreadsheet_id, ranges, render | 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. |
google_sheets.google_sheets_batch_write | Read | spreadsheet_id, data, input | Write to multiple ranges in a Google Spreadsheet in one call. Provide an array of {range, values} objects to update several areas at once. |
google_sheets.google_sheets_clear | Read | spreadsheet_id, range | Clear all values from a Google Sheets range (keeps formatting intact). Specify the range in A1 notation. |
google_sheets.google_sheets_create | Read | title | Create a new empty Google Spreadsheet with a given title. Returns the new spreadsheet ID and URL. |
google_sheets.google_sheets_delete_columns | Write | spreadsheet_id, sheet, start_index, count | Delete columns from a Google Sheets sheet/tab. Uses 0-based indexing. |
google_sheets.google_sheets_delete_rows | Write | spreadsheet_id, sheet, start_index, count | Delete rows from a Google Sheets sheet/tab. Uses 0-based indexing. |
google_sheets.google_sheets_delete_sheet | Write | spreadsheet_id, sheet | Delete a sheet/tab from a Google Spreadsheet. |
google_sheets.google_sheets_duplicate_sheet | Write | spreadsheet_id, sheet, title | Copy a sheet/tab within the same Google Spreadsheet. |
google_sheets.google_sheets_find | Read | spreadsheet_id, query, sheet, match_case, match_entire_cell | 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. |
google_sheets.google_sheets_get_metadata | Read | spreadsheet_id | 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. |
google_sheets.google_sheets_insert_columns | Read | spreadsheet_id, sheet, start_index, count | Insert blank columns into a Google Sheets sheet/tab. Uses 0-based indexing. |
google_sheets.google_sheets_insert_rows | Read | spreadsheet_id, sheet, start_index, count | Insert blank rows into a Google Sheets sheet/tab. Uses 0-based indexing. |
google_sheets.google_sheets_read_range | Read | spreadsheet_id, range, render | 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`. |
google_sheets.google_sheets_remove_filter | Write | spreadsheet_id, sheet | Remove the filter from a Google Sheets sheet/tab. |
google_sheets.google_sheets_rename_sheet | Read | spreadsheet_id, sheet, title | Rename a sheet/tab in a Google Spreadsheet. |
google_sheets.google_sheets_sort_range | Read | spreadsheet_id, range, sort_column, ascending | Sort data by column(s) in a Google Sheets range. |
google_sheets.google_sheets_write_range | Read | spreadsheet_id, range, values, input | 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)"]]`. |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.