Deleting categories and their child

Hi there,

In my app, users can create categories, then subcategories, then subsubcategories and so on (5 levels).

But they can also delete any category or subcategory, at all level.

I am using unique id’s in order to ensure the link between these items remains even if the user change the item name. But, in case of item deletion, the child of this item remain alone, most in the dark of my sheet, and are consuming rows.

I would need your advice on the best way to manage this issue. I thank about creating an “orphans items” sheet were all lost items would be stored, using a formula or a Google script based on unique id’s manipulation.

What would be your advice, or your experience with such behavior and issue?

I agree that any child of a category can not be automatically deleted, the app can not (must not) delete user data without the consentment of the users.

Many thanks for any advice or quickwin!


Thinking out loud:

In the Categories sheet add a array-Formula: There must be a column which shows “yes” IF category has children

In glide show a tab to users with a filter. Only show categories where “children column” is empty.
When a user clicks these no-child-categories, the deletion option is enabled.

Another tab with the oposite filtering where users can NOT delete. Only show categories where “children column” is NOT empty.

@Sidney_Kunst I don’t think you can control the appearance of the Delete button that way. I know you said you were thinking out loud, so I’m guessing that you didn’t try it.

@Christophe_HK The only way I can think of would be to run a script on a nightly time based trigger, that would clean up these orphaned rows.

Hi guys,

Many thanks for your feedback. I am going to check the most suitable. I think a good alternative is a mix of the two :it would be to isolate orphans items in a dedicated list, make them editable with a “delete?” checkbox, and then a script would be responsible in deleting all to-be-deleted items, nightly.