Store variables between workflow runs using data tables as a key-value store
Store Variables Between Workflow Runs Using n8n's Built-In Data Tables (Key-Value Store) Purpose This workflow implements a simple key value store based on the built-in data tables feature in n8n – no external service...
Template notes
Store Variables Between Workflow Runs Using n8n's Built-In Data Tables (Key-Value Store)
Purpose
This workflow implements a simple key value store based on the built-in data tables feature in n8n – no external service needed.
What this is for
This is a workflow snippet which could be used to store a “last checked” timestamp or other variables between workflow runs.
Setup
- Self-deploying – no extra setup needed - Just clone the template into your n8n instance and follow the instructions on the yellow sticky notes
How it works A data table is used as a key value store having the two columns “key” and “value”. It is referenced by name, which makes it easier to migrate this workflow to other instances. 1. At the beginning a variable is retrieved by it’s key 2. If the variable / key does not exist yet, a default value is set, otherwise the stored value is being returned 3. The variable can now be used and updated (see customization below) 4. The variable is being created/updated in the database for the next workflow run If the variable did not exist before it get’s created Fallback: If the table doesn’t exist, it automatically gets created