DELETE - Delete Rows

Created by Danny Chu, Modified on Tue, 26 Jul, 2022 at 2:39 PM by Danny Chu

You can delete data from your Sheet by making a DELETE request to your API.

Basic Delete

Append the row number on your API URL following this pattern: 

https://sheet.best/api/sheets/<api id>/<row number>

 and you will delete that row from the Sheet.


Example: If your API URL is 

https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf, make delete calls to: https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf/2

to delete the third row from your Sheet (it is 0 indexes).

Filtered Delete

You can also make Filtered Deletes to delete rows that fits in a filter.

Let's say you have a table like this one:



If you want to delete all rows that have "Jane" inside the "Name" column, you can make a DELETE request to:


https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf/Name/*Jane*


For more Filtered Delete options, check out our Filtering Data section, for more options, all options supported there are supported here.



-------


Shell

# Basic Delete
curl 'https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf/2' -X DELETE

# Filtered Delete
curl 'https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf/Name/*Jane*' -X DELETE


Python


import requests

# Basic Delete
requests.delete("https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf/2")

# Filtered Delete
requests.delete("https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf/Name/*Jane*")

Javascript


// Basic Delete
fetch("https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf/2", {
  method: "DELETE",
})
  .then((response) => response.json())
  .then((data) => {
    console.log(data);
  })
  .catch((error) => {
    console.error(error);
  });

// Filtered Delete
fetch(
  "https://sheet.best/api/sheets/cf969697-682a-40e3-bad4-d54803eeeacf/Name/*Jane*",
  {
    method: "DELETE",
  }
)
  .then((response) => response.json())
  .then((data) => {
    console.log(data);
  })
  .catch((error) => {
    console.error(error);
  });


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article