Updating Rows (PUT / PATCH)
Both PUT and PATCH update rows in your sheet. They differ in how they handle
columns you do not include in the body.
| Method | Behaviour |
|---|---|
PATCH | Partial update. Only the columns in the body are written; other columns are left untouched. |
PUT | Full replace. Columns not in the body are blanked out on the affected rows. |
Both methods return the affected rows.
Updates require edit access on the underlying Google Sheet, just like POST.
Update a row by index
Append the zero-based row index to the URL. /1 updates the second data row.
- cURL
- JavaScript
- Python
# PATCH: only updates Name, leaves other columns alone
curl 'https://api.sheetbest.com/sheets/<api-id>/1' \
-X PATCH \
-H 'Content-Type: application/json' \
-d '{"Name": "Jack Doe"}'
# PUT: sets Name and blanks out every other column on row 1
curl 'https://api.sheetbest.com/sheets/<api-id>/1' \
-X PUT \
-H 'Content-Type: application/json' \
-d '{"Name": "Jack Doe"}'
// PATCH
fetch('https://api.sheetbest.com/sheets/<api-id>/1', {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ Name: 'Jack Doe' }),
}).then((r) => r.json()).then(console.log);
// PUT
fetch('https://api.sheetbest.com/sheets/<api-id>/1', {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ Name: 'Jack Doe' }),
});
import requests
# PATCH
requests.patch(
'https://api.sheetbest.com/sheets/<api-id>/1',
json={'Name': 'Jack Doe'},
)
# PUT
requests.put(
'https://api.sheetbest.com/sheets/<api-id>/1',
json={'Name': 'Jack Doe'},
)
Filtered update
Update every row that matches a column filter by replacing the row index with
/<Column>/<Value>. Wildcards (*) are supported.
- cURL
- JavaScript
- Python
# Set Name to "Jack Doe" on every row whose Name contains "John"
curl 'https://api.sheetbest.com/sheets/<api-id>/Name/*John*' \
-X PATCH \
-H 'Content-Type: application/json' \
-d '{"Name": "Jack Doe"}'
fetch('https://api.sheetbest.com/sheets/<api-id>/Name/*John*', {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ Name: 'Jack Doe' }),
});
requests.patch(
'https://api.sheetbest.com/sheets/<api-id>/Name/*John*',
json={'Name': 'Jack Doe'},
)
PUT works the same way; remember it blanks columns not in the body on every
matched row.
The filter syntax is the same one used for reads. See
Filtering Data for exact match, wildcard, and
multi-column options. Updates also accept the /tabs/<TabName> prefix —
see Working with Tabs.
Response
Both methods return the affected rows after the update is applied:
[
{ "Id": "1", "Name": "Jack Doe", "Age": "23" }
]
Forcing PATCH semantics from a PUT-only client
Some clients — older HTTP libraries, certain no-code platforms, embedded
environments, or webhook tools — can only send PUT. To get PATCH (partial
update) behaviour from such a client, send a PUT request and include the
X-HTTP-Method-Override
header set to PATCH:
curl 'https://api.sheetbest.com/sheets/<api-id>/1' \
-X PUT \
-H 'Content-Type: application/json' \
-H 'X-HTTP-Method-Override: PATCH' \
-d '{"Name": "Jack Doe"}'
Sheet Best will process the request as if you had sent PATCH, leaving columns
that are not in the body untouched instead of blanking them out.
See Custom Headers for the full reference, including which methods and values are accepted.