Use the Google Sheets CLI from KosmoKrator to call Google Sheets tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.
Google Sheets can be configured headlessly with `kosmokrator integrations:configure google_sheets`.
# Install KosmoKrator first if it is not available on PATH.curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash# Configure and verify this integration.kosmokrator integrations:configure google_sheets --set access_token="$GOOGLE_SHEETS_ACCESS_TOKEN" --enable --read allow --write ask --jsonkosmokrator integrations:doctor google_sheets --jsonkosmokrator integrations:status --json
Credentials
Authentication type: OAuth browser flowoauth2_authorization_code. Configure credentials once, then use the same stored profile from
scripts, coding CLIs, Lua code mode, and the MCP gateway.
Key
Env var
Type
Required
Label
access_token
GOOGLE_SHEETS_ACCESS_TOKEN
OAuth token oauth
yes
Google Account
Call Google Sheets Headlessly
Use the generic call form when another coding CLI or script needs a stable universal interface.
Every function below can be called headlessly. The generic form is stable across all integrations;
the provider shortcut is shorter but specific to Google Sheets.
google_sheets.google_sheets_add_filter
Write write
Apply filter dropdowns to a range in a Google Sheets sheet/tab.
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.
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.
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.
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.
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`.
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)"]]`.
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.
A1 notation range (e.g., "Sheet1" or "Sheet1!A:D").
values
array
yes
2D array of rows to append (e.g., [["Alice", 30], ["Bob", 25]]).
input
string
no
Input mode: "user_entered" (default, parses formulas/dates) or "raw" (literal strings).
google_sheets.google_sheets_batch_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.
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.
Sheet name to search in. Omit to search all sheets.
match_case
boolean
no
Case-sensitive search. Default false.
match_entire_cell
boolean
no
Match entire cell content only. Default false.
google_sheets.google_sheets_get_metadata
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.
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`.
A1 notation range to sort (e.g., "Sheet1!A1:D10").
sort_column
integer
yes
0-based column index within the range to sort by.
ascending
boolean
no
Sort ascending (true, default) or descending (false).
google_sheets.google_sheets_write_range
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)"]]`.
2D array of values. Each inner array is a row (e.g., [["Name", "Age"], ["Alice", 30]]).
input
string
no
Input mode: "user_entered" (default, parses formulas/dates) or "raw" (literal strings).
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults
with integrations:configure. Add --force only for trusted automation that should bypass that policy.