# PUT - Updating Rows

You can update rows in your sheets by sending PUT requests to the sheet endpoint. You can update rows either viw row id or using the filter to update one or multiple rows.

# Updating using row id

You need to send a JSON object with the row data to the sheet endpoint in order to update a row and specify the row id in the query string using _id parameter.

For example, if you want to update the first row in the sheet, you need to send a PUT request like this:


curl -X PUT \
  "https://sheetrest.com/api/v1/sheets/SHEET_ID?_id=0" \
  -H 'Content-Type: application/json' \
  -d '{
    "Name": "Bob",
    "Age": 30,
    "City": "New York"
  }'
fetch('https://sheetrest.com/api/v1/sheets/SHEET_ID?_id=0', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    Name: 'Bob',
    Age: 30,
    City: 'New York',
  }),
});

# Updating using filter

You can update one or multiple row by using the same filter as in the GET request. See GET Documentation for more details.

For example, if you want to overwrite all the rows where name equals to Bob and age it greater than 30, you need to send a PUT request like this:


curl -X PUT \
  "https://sheetrest.com/api/v1/sheets/SHEET_ID?Name=Bob&Age=__gt(30)" \
  -H 'Content-Type: application/json' \
  -d '{
    "Name": "Bob",
    "Age": 40,
    "City": "New York"
  }'
fetch('https://sheetrest.com/api/v1/sheets/SHEET_ID?Name=Bob&Age=__gt(30)', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    Name: 'Bob',
    Age: 40,
    City: 'New York',
  }),
});