Adding A Count Column To Data Tables

The idea is:

To add a Count column to Data Tables or to be able to swap from ID to Count.

My use case:

In my instance, I use n8n in combination with browserlessV2 to scrape gas prices in my area and show them in Home Assistant. The current setup scans every ~2.5hrs, it adds up pretty quickly and I want to limit the data points. Currently the Delete-Row(s)option is good when you want erase everything however when wanting to store a range of data it doesn’t work. Having a column dedicated to an overall count will always be reliable. The 5th row will always be that as opposed to the ID shifting positions.

( Another related concept would be allowing the Data Table Node(s) read the data in Ascending and Descending order. That way older data read from row 1+ would be the higher in value and thus could be deleted by selecting say equal to or greater than #value. )

I think it would be beneficial to add this because:

I believe this feature would allow more control over Data Tables by giving users the option to set hard limits when collecting data.

Interesting feature idea. As a workaround that works today: instead of waiting for a count column, you could add a timestamp field to each row when inserting (most Data Table setups already have createdAt available), then in your cleanup workflow, query sorted by that timestamp ascending and delete everything beyond your desired row count.

That gives you the same effect as ascending/descending ordering you mentioned, you just handle the sort and limit logic in a Code node or Filter node before the delete step, rather than relying on a native count column. Not as clean as a built-in feature, but it would solve your gas price use case without waiting on a roadmap item.

1 Like