Update
Update with single query
Updates the content for the specified row. You must specify a column name and a value to find the row(s) you want to update. All rows that meet the condition will be updated. It updates only the columns passed in the data object, the other columns will remain unchanged.
Returns count of updated rows.
The {VALUE} part of the URL accepts the same syntax as the search endpoint: wildcards (*), negation (!), relational operators (<, >, <=, >=) and the casesensitive attribute. For example, PATCH /api/v1/{API_ID}/name/J* updates every row whose name starts with "J". Wildcards work here regardless of the READ permission.
If no row matches, you will receive a 404 error with {"error": "No results found"}. If the column does not exist, you will receive a 404 error with {"error": "Undefined column: {COLUMN_NAME}"}.
Required attributes
- Name
data- Type
- json
- Description
The object containing the data you want to change.
Example:
{'name': "Mark", 'age': 28}
Optional attributes
- Name
sheet- Type
- string
- Description
The sheet (tab) you want to select.
- Name
mode- Type
- string
- Description
Value Input Option, more info here.
- Name
casesensitive- Type
- boolean
- Description
By default, matching is not case-sensitive. Set this attribute to
trueto make it case-sensitive.
Request
curl -X PATCH -G https://sheetdb.io/api/v1/58f61be4dda40/id/3 \
-d name=Emma
JSON Response
{
updated: 1
}
Batch update
Batch update works only on paid accounts
Update for multiple queries. The required attribute data should be an array, and each object in it should have a query (for example, "id=3").
All queries will be updated as in a regular PATCH update.
It returns the number of updated rows.
The query value accepts the same syntax as the single update, including wildcards, negation and relational operators. Unknown columns return a 404 error with {"error": "Undefined column: {COLUMN_NAME}"}, and {"error": "No results found"} is returned when no query matched any row.
Required attributes
- Name
data- Type
- json
- Description
An array containing the objects you want to change. Each object should contain a
querythat will filter the rows to be updated.Example:
[ { "query":"id=1", "name":"Sophia", "age":20 },{ "query":"id=2", "age":25 } ]
Optional attributes
- Name
sheet- Type
- string
- Description
The sheet (tab) you want to select.
- Name
mode- Type
- string
- Description
Value Input Option, more info here.
Request
curl -X PATCH -G https://sheetdb.io/api/v1/58f61be4dda40/batch_update \
-d data='[{"query":"id=1","name":"Sophia","age":20},{"query":"id=2","age":25}]'
JSON Response
{
updated: 2
}