🗑️ Delete Row
This option will enable you to delete a specific row in your spreadsheet from your app. Below it's explained how you can do it too...
To Delete a row, we will need the Delete Row and Search in Sheet block
Understanding the working of this Block
This block is meant to check if some data entered by the user is there in a specific column or not.
inColumn – Name of Column where you want to search the data
query – Data you wish to search for
fromColumn – Attach a blank text since we need row number in return
Right now, in this docs ill be checking if a specific email is there in the email column or not.
So as per the sample sheet I have taken for this docs, the name of the column where email addresses are stored is Email, so in the columnName block ill pass the name of that column (case sensitive) and in the query block ill pass the textbox I have given to my user for entering his/her email address. In my case I want to check for a specific email address so ill set the columnName to Email (Name of my column in the spreadsheet )
Now we will proceed to the Got Search Result block
First we will have to check for the response code we have got. If the response code is 200 then we can proceed else we will inform the user that an error has occurred.
Once we have got the response code as 200 then we will use an if then block and we will check if we have got the value as 0, if we have got the value as 0 then it means that the query we are searching for is not present in the database if we have not got 0 as the value then we will use the value that we have got in return.
The value that we have got in return is the row no associated with the submitted query.
So we will now use the DeleteRow block and in row number we will use the get value block.
Once we are done with this, our next task is to work with the RowDeleted block.
This block is really simple, first we will check if the response code we have received is 200 or not, if its 200 then that means that the targeted row has been deleted successfully from the database. If we have not got the response code as 200 then that means that some error code has occurred and we will inform the user about it.
This was the process of deleting a row using the Cloudsheets extension.
Documentation by Tanish Raj – Lead Developer, Cloudsheets