# Delete a record from Google sheet

**URL:** <https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278>\
**Category:** Questions about Thunkable X\
**Tags:** beginner\
**Created:** [February 17, 2022, 11:00am UTC](https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278 "2022-02-17T11:00:57Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![andos-avlog](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/andos-avlog/32/122340_2.png) [@andos-avlog](https://community.thunkable.com/u/andos-avlog)\
**Post date:** [February 17, 2022, 11:00am UTC](https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278/1 "2022-02-17T11:00:57Z")

</div>

Hi, I am trying to create a delete function which will delete a selected record. I have had a look at **muneer’s** suggestion at this link: **[Profile - muneer - Community](https://community.thunkable.com/u/muneer)** and I am not sure if it pertains to my required ‘single row delete’ requirements or to a ‘delete all records’. I suspect the former to be the solution.

I have my app variable data set up as below:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/6/0648cd4de96927d0f441062287a6b99d7d8933c3.png)

Using a record called “TESTDELETE” for my example I shall try to explain what I have achieved so far (see below):

**I wish to delete the “TESTDELETE”** from my Source Data Google Sheet “ **FVENTRYFORM** ”

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/5/15b0d900fa17b776e939c2d3e9a0e00ab1493e11.png)

When the user clicks the “ **Delete** ” button the first of two error messages ( **FVYesNoLabel** ) appears to warn the user of their actions (see below)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/8/58b3f2d58d1f4176af01c231608b5bd36251a70c.png)

The user then has the option to proceed or not by clicking either the, now displayed, “ **Delete** ” or “ **Cancel** ” button. If, at this point, the user decides to click the “ **Delete** ” button they are faced with a final message in the form of the alert ( **FVDeleteAlert1** ) shown below:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/6/56c1f1c41b5e4da952a4db34dc7c8829fc829700.png)

When “ **Confirm** ” is clicked, the “ **TEST DELETE** ” record in question should then be deleted from the Source Data Google Sheet “ **FVENTRYFORM** ”.

Looking at my blocks below and then looking at **muneer’s solution** , I am wondering how to implement it into my project.

My blocks:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/a/6aae6ada4cd912f18c52bdf22d3db85e1c0db272.png)

The problem I am having is in the “ **When/BtnFVDelYes/click** ” block after I call the “ **FVDeleteAlert** ” alert msg. Because this is first time I have tried to use the “ **wasConfirmed** ” blocks I am not sure how to make them delete the “ **TESTDELETE** ” record and briefly display a “ **Record Deleted** ” msg.

This was when I found muneer’s solution ( image below) which suggested to me that my approach must be wrong but I am not sure how to incorporate his solution into my blocks.

> [@Deleting datas saved on google sheets](https://community.thunkable.com/t/deleting-datas-saved-on-google-sheets/1656254/2):
>
> use this block
> 
> ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/b/0b2135178e0525af42fd3b35571e2e424cf12f3f.png)

In the “ **for row id** ” socket would I use my " **row\_data" or “row\_number” variable** or something else completely?

Do I put **muneer’s** blocks in my “ **When/BtnFVDelYes/click** ” blocks, and if so, where?

I am very confused and suffering with “block blindness”.

Andos.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [February 17, 2022, 11:25am UTC](https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278/2 "2022-02-17T11:25:17Z")

</div>

I have to say that I changes the subject of the post to something more meaningful than my own name.

In your `FVDeleteAlert` you are having **two** IF Conditions that refer to the same thing. You should use **ELSE** in the first condition to manage the second condition.

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/7/770629f946573556f4aae1fb883fd0d9445e9e9b.png)  
Can you explain what the `app variable row_data` contains. For the `delete row` block to work you need to supply the **row ID** which is either a number of the order of this row in the sheet or a unique string to identify this record. It seems that this variable contains the row information which is not what is expected by the `delete row` block.

---

<div class="post-metadata">

**Author:** ![andos-avlog](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/andos-avlog/32/122340_2.png) [@andos-avlog](https://community.thunkable.com/u/andos-avlog)\
**Post date:** [February 17, 2022, 9:12pm UTC](https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278/3 "2022-02-17T21:12:43Z")

</div>

Hi @muneer, the “app variable row\_data” contains the record’s field data (see image below)

 ![Screenshot 2022-02-17 20.12.41](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/9/a9cec82598f2a3b792c7899c6e8d82fbf9f9d843.jpeg)

Would the “app variable row\_number” be the row\_id as in the image below?

![Screenshot 2022-02-17 21.07.17](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/0/80500e3e9433391ff8a2048ac40960b2996f1566.png)

Also, below I have amended my “ **FVDeleteAlert** ”. Is this now correct?

 ![Screenshot 2022-02-17 20.52.08](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/7/8773936187e2e47a74c7b296a077322693d3bd89.png)

Andos.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [February 18, 2022, 10:24am UTC](https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278/4 "2022-02-18T10:24:14Z")

</div>

> [@andos-avlog](#):
>
> Would the “app variable row\_number” be the row\_id as in the image below?

Yes, that would be a good choice.

> [@andos-avlog](#):
>
> Also, below I have amended my “ **FVDeleteAlert** ”. Is this now correct?

I believe you are placing them the wrong way round.

---

<div class="post-metadata">

**Author:** ![andos-avlog](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/andos-avlog/32/122340_2.png) [@andos-avlog](https://community.thunkable.com/u/andos-avlog)\
**Post date:** [February 18, 2022, 10:32am UTC](https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278/5 "2022-02-18T10:32:10Z")

</div>

Ok, thanks @muneer, I shall change that and let you know how I get on.

Thanks,

Andos.

---

<div class="post-metadata">

**Author:** ![andos-avlog](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/andos-avlog/32/122340_2.png) [@andos-avlog](https://community.thunkable.com/u/andos-avlog)\
**Post date:** [February 18, 2022, 12:07pm UTC](https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278/6 "2022-02-18T12:07:00Z")

</div>

Hi @muneer, that did the trick. Thanks!

However, I have noticed that once a record has been deleted it leaves an **empty row** in the Data Source Google Sheet. This then causes the **row data of subsequent records to not display** in the app when a search record is located below the empty row in the Source Data Google Sheet.

Is there a way for the app to also remove the deleted row’s id and consequently the empty row in the Google Sheet?

Andos.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [February 18, 2022, 2:20pm UTC](https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278/7 "2022-02-18T14:20:08Z")

</div>

> [@andos-avlog](#):
>
> I have noticed that once a record has been deleted it leaves an **empty row** in the Data Source Google Sheet.

This should not be the case. When a record is deleted then the rows below it jumps up.

Can you please check again and if this behavior persists then you need to report a **BUG**.

@jared can you have a look?

---

<div class="post-metadata">

**Author:** ![andos-avlog](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/andos-avlog/32/122340_2.png) [@andos-avlog](https://community.thunkable.com/u/andos-avlog)\
**Post date:** [February 18, 2022, 5:36pm UTC](https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278/8 "2022-02-18T17:36:04Z")

</div>

I tried this is a few times so I shall have to report a bug. Do I report this to Google?

Andos.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 18, 2022, 6:29pm UTC](https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278/9 "2022-02-18T18:29:04Z")

</div>

No, you should report it to Thunkable here:

> **[Bugs and Feature Requests](https://docs.thunkable.com/bugs-and-feature-requests)**

Make sure to provide a link to a basic project that demonstrates this problem.

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [February 18, 2022, 6:57pm UTC](https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278/10 "2022-02-18T18:57:56Z")

</div>

Hey guys! @muneer @andos-avlog @tatiang

Thanks for the triaging here. I’m seeing the same thing on my end.

I’m filing a bug report at the moment!

---

<div class="post-metadata">

**Author:** ![andos-avlog](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/andos-avlog/32/122340_2.png) [@andos-avlog](https://community.thunkable.com/u/andos-avlog)\
**Post date:** [February 18, 2022, 8:46pm UTC](https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278/11 "2022-02-18T20:46:15Z")

</div>

Ok @taiang, I shall do that tomorrow.

Andos.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 18, 2022, 8:57pm UTC](https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278/12 "2022-02-18T20:57:12Z")

</div>

Sounds like @jared was able to duplicate the issue so it’s probably not necessary at this point. Hopefully this gets fixed soon!

---

<div class="post-metadata">

**Author:** ![andos-avlog](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/andos-avlog/32/122340_2.png) [@andos-avlog](https://community.thunkable.com/u/andos-avlog)\
**Post date:** [February 19, 2022, 8:38am UTC](https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278/13 "2022-02-19T08:38:14Z")

</div>

Hi @tatiang, I hope so too!

Many thanks @tatiang, @muneer, @jared,

Andos.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [May 20, 2022, 8:39am UTC](https://community.thunkable.com/t/delete-a-record-from-google-sheet/1739278/14 "2022-05-20T08:39:01Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
