Skip to main content

Store variables between workflow runs using data tables as a key-value store

Workflow preview

Workflow preview
100%
Store variables between workflow runs using data tables as a key-value store preview
Open on n8n.io

1. Workflow Overview

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 –...

Best for

  • Miscellaneous automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.datatable, n8n-nodes-base.stopanderror, n8n-nodes-base.if, n8n-nodes-base.manualtrigger, n8n-nodes-base.set, n8n-nodes-base.stickynote, n8n-nodes-base.noop

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Mario.

Original n8n.io source

1.1 Workflow description

Title
Store variables between workflow runs using data tables as a key-value store
Workflow name
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 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

Compatibility

  • n8n Version 2.5.0 or above
  • Cloud or Self-Hosted

Note: Please make sure to use this feature with care when storing passwords or access tokens since those can be exposed via the n8n API when querying past executions with their data or data tables directly. Those kind of data should preferably stored inside of credentials directly.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Create Globals table

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 2 - Stop and Error

Type / Role
n8n-nodes-base.stopAndError - stopAndError
Config choices
Version 1

Block 3 - If not the expected error

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 4 - Global found

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 5 - When clicking ‘Execute workflow’

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 6 - Get Global "your_variable_name"

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 7 - Set default value

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 8 - Format value

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 9 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Do something

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 13 - Upsert Global "your_variable_name"

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1.1

Block 14 - Sticky Note7

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Sticky Note9

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Sticky Note8

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Store variables between workflow runs using data tables as a key-value store
Complexity advanced
Nodes 16
Categories Miscellaneous
Author Mario
Published 16 Feb 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/13442/13442.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Store variables between workflow runs using data tables as a key-value store do?

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 –...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Miscellaneous use case.