Learn how to store workflow data in n8n with simple methods to organize, save, and manage automations efficiently.

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
In n8n you don’t really “store workflow data” inside the workflow itself. Instead, you persist data using something outside the workflow: a database, a storage node, static data, or an external system. n8n only keeps data in memory while the workflow runs, unless you explicitly save it somewhere.
Below are the real and reliable ways to store workflow data in production, from simplest to most robust.
This is built-in storage that exists inside the workflow. It is good for small values you need between runs (like counters, timestamps, config). It is not good for large or frequently changing data.
Two types exist:
How to write in a Function node:
// Save a value to workflow static data
const staticData = this.getWorkflowStaticData('global'); // or 'node'
staticData.lastRunValue = 42;
return items;
Read value later:
const staticData = this.getWorkflowStaticData('global');
return [{ json: { value: staticData.lastRunValue }}];
Good for: counters, last-processed ID, small flags.
Not for: records, logs, user data, anything large or structured.
This is n8n’s built-in key–value store that belongs to the workflow. It’s persistent and simpler than dealing with databases. But it is still meant for small to medium data, not entire datasets.
Use cases:
Example of writing a key:
return [
{
json: {
key: 'lastProcessedId',
value: 1234
}
}
];
Then the Workflow Data node saves it. Another Workflow Data node can read it later.
For anything beyond "small config", always use a real external system. This is what actual production workflows do.
You can use:
n8n has nodes for these. Insert, update, select — all handled with queries.
Example query in a PostgreSQL node:
INSERT INTO events (workflow_id, payload)
VALUES ({{$json.id}}, {{$json | jsonStringify}});
This is the most reliable way to store workflow data long-term.
If you don’t want to run a database, you can store workflow data in:
These are great for:
Example with Google Sheets: append data for logging.
// Pass an object to Google Sheets Append
return [
{
json: {
timestamp: new Date().toISOString(),
email: $json.email,
status: 'processed'
}
}
];
If the workflow needs to store files (PDFs, images), n8n stores them as binary data connected to an execution. For long-term, push them to external storage like S3.
In real production, the cleanest and safest path is: workflow runs → writes into database → continues processing. n8n executes the orchestration, while the persistent state lives externally.
When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.