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

Medium complexity Trigger10 nodes🏷️ Miscellaneousby Mario

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

Nodes used

Upsert Global "your_variable_name"Stop and ErrorGlobal foundWhen clicking ‘Execute workflow’Format valueSticky Note8Do something

Workflow Preview

1. Get variable
Fallback: Create table if it does not exist
_Needs to run first if previous node
failed - hence it is placed above_
2. Define default value if needed
4. Save variable
How it works
A data table is used as a key value store having the tw
_It is referenced by name, which makes it easier to mig
1. At
3. Use variable
C
Create Globals table
S
Stop and Error
I
If not the expected error
G
Global found
W
When clicking ‘Execute w…
G
Get Global "your_variabl…
S
Set default value
F
Format value
D
Do something
U
Upsert Global "your_vari…
10 nodes10 edges

How it Works

  1. 1

    Trigger

    The workflow starts with a trigger trigger.

  2. 2

    Process

    Data flows through 10 nodes, connecting datatable, if, manualtrigger.

  3. 3

    Output

    The workflow completes its automation and delivers the result to the configured destination.

Node Details (10)

UP

Upsert Global "your_variable_name"

dataTable

#1
ST

Stop and Error

stopAndError

#2
GL

Global found

if

#3
WH

When clicking ‘Execute workflow’

manualTrigger

#4
FO

Format value

set

#5
ST

Sticky Note8

stickyNote

#6
DO

Do something

noOp

#7

How to Import This Workflow

  1. 1Click Download JSON button on the right to save the workflow file.
  2. 2Open your n8n instance. Go to Workflows → New → Import from file.
  3. 3Select the downloaded store-variables-between-workflow-runs-using-data-tables-as-a-key-value-store file and click Import.
  4. 4Set up credentials for each service node (API keys, OAuth, etc.).
  5. 5Click Test Workflow to verify everything works, then activate it.

Or paste directly in n8n → Import from JSON:

{ "name": "Store variables between workflow runs using data tables as a key-value store", "nodes": [...], ...}

Integrations

datatableifmanualtriggersetstopanderror

Get This Workflow

Download and import in one click

Download JSONView on n8n.io
Nodes10
Complexitymedium
Triggertrigger

Created by

Mario

Mario

@octionic

Tags

datatableifmanualtriggersetstopanderror

New to n8n?

n8n is a free, open-source workflow automation tool. Self-host it or use the cloud version.

Get n8n Free →

Related Miscellaneous Workflows