When I use a button with the ‘action’ ‘delete row’ in a ‘List’ component that has a google sheet underneath, when I click the button it deletes the data but when the google sheet has several fields with ‘arrayformula’ either the row is recreated or it is not deleted. The rest of the fields that do not have ‘arrayformula’ are deleted, but the result is bad because the empty row reappears in the ‘list’. What can be done?
My advice would be to get rid of the arrayformula, and move the logic into the Glide Data Editor.
For me is not a solution is quite integrate with Google Workspace apps. An the use of arrayformula is needed to
What does your arrayformula look like?
You should be able to structure it in such a way that blank rows will be ignored.
By example: =ARRAYFORMULA(IF(AW2:AW=“”; “”; IF(AW2:AW=3; “consulta OK”; IF(AW2:AW=2; “cancelada”; “resto de opciones”)))).
The arrayformula are needed to deal with gForm we used to add new records. And in the cell not cover by the form we used arrayformulas
So what does your formula return on a “deleted” row? An empty string, but it doesn’t remove the line in Glide?
I do not know how the deletion works. It seems that DELETE deletes the data first…but after a few seconds it reappears in this case with empty non-arrayformula fields. But the record is not deleted
Here is a suggestion. Instead of deleting rows, mark them as “deleted”, hide them, and then use an Apps Script trigger to delete them from the Google Sheet.
You could do that as follows:
- Add a “Deleted At” date/time column to the table.
- When somebody “deletes” a row in the App, instead of a Delete Row action, use a Set Column Values action to write the current date/time into the Deleted At column.
- In Glide, hide any rows where that column is not empty.
- In your Google Sheet, set up a time based trigger that runs periodically, checks for non-empty values in that column, and deletes any that it finds.
Just one thing to keep in mind is if you do take that approach, you should always start checking from the bottom of the sheet, and work your way up. This is because every time you delete a row, the row indexes of all rows below it will shift up by one, so if you aren’t careful you can wind up deleting the wrong rows.
Thanks Darren!!
This is a nice workaround