sort_sheet_range
Sort a range by specified columns.
destructiveGoogle Sheets, Docs & Drive
Call it
In an AI client (MCP)
{
"name": "sort_sheet_range",
"arguments": {
"spreadsheet_id": "<spreadsheet_id>",
"range_": "<range_>",
"sort_specs": []
}
}From code (Tool API)
curl -X POST https://api.sellersheetai.com/api/v1/tools/sort_sheet_range \
-H "Authorization: Bearer $SELLERSHEET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"spreadsheet_id":"<spreadsheet_id>","range_":"<range_>","sort_specs":[]}'Early access — the Tool API is open on request, contact us.
Arguments
| Name | Type | Description |
|---|---|---|
spreadsheet_idrequired | string | the spreadsheet ID (from its URL or get_sheet_metadata). |
range_required | string | A1 notation range (e.g. 'Sheet1!A2:D100'). |
sort_specsrequired | object[] | [{dimensionIndex, sortOrder}]. dimensionIndex is a 0-based column index (A=0, B=1, …); sortOrder is ASCENDING or DESCENDING. Every row of range_ moves, so start range_ below the header row (e.g. 'Sheet1!A2:D100'). |
Result
Every tool answers {notification, data, human_action}; data carries:
- Success confirmation.
Gotchas
- Every range here must name its tab; an open end is allowed ('Tab!C7:C' runs to the bottom, 'Tab!A:D' is whole columns); a range without a tab ('A1:D10') is refused.
Example
sort_sheet_range("1ABC...", "Sheet1!A2:D100", [{'dimensionIndex': 0, 'sortOrder': 'ASCENDING'}])