Saturday, June 21, 2025

Tip #2: Using Google Sheets as UI for your n8n workflow

Very often you need more control on input and output data for your n8n workflow, i.e. store input data in tabular format, execute n8n workflow on some specific part of your data, store new fields from n8n workflow output, etc. In other words you need some kind of UI for your n8n workflow. Google Sheets is very popular and easy way to do it and also it's well intergrated with n8n. Let's create a simple Google Sheet with the fields Color, Status and Number:

Creating simple Google Sheet for n8n workflow input and output control

Here Color is just a color name, Status can be READY or DONE and Number is a string length of Color name.

We will use this Google Sheet as UI for our n8n workflow, Color will be input data, Number will be output data and Status will control which data will be used as input data on the next execution and show which data already has an output.

Let's switch to n8n workflow and first add Google Sheets node to read all the rows with Status READY:

Adding Google Sheet node to n8n workflow to read input data
If you execute it you can see your tabular data with Status READY:

Getting output of Google Sheets node after reading input from Google Sheet

Now let's add a Loop node and Set node within it:

Adding Loop node and Set node within it to n8n workflow

Set node should pass row_number value to output and return length of Color name which we will put into Google Sheet as Number. Also we want to update Status to DONE:

Finally let's add Google Sheets node again but for updating the rows:

Adding Google Sheets node for updating rows in n8n workflow

It will map columns automatically and also use row_number for matching rows:

Setting Google Sheets node for mapping columns automatically and updating matching rows in n8n workflow

Well, let's execute and check the output:

Checking the output of Google Sheet node in n8n workflow

Looks as expected and now let's check Google Sheet itself:

Checking Google Sheet after n8n worflow execution

Nice! Google Sheet has been updated as well.

If we execute our n8n workflow again, nothing will be done because there are no more rows with Status READY. So this way we can control input values for our n8n workflow. And also we can see output values and Status.

Google Sheet for this tip is available here.

Sunday, June 15, 2025

Tip #1: Testing n8n sub-workflow

Sometimes you need to move a set of nodes to a separate sub-workflow in n8n and execute it by the main workflow. It allows to make your workflow more compact and also reuse it's part in other workflows. But how to test it properly without executing it by the main workflow?

So let's start with some simple sub-workflow. Of course the first node will be Execute Sub-workflow Trigger node:

Starting new n8n sub-workflow

Let's add some input field:

Adding input field to n8n sub-workflow

Now let's add Manual Trigger node which will be used for testing purposes:

Adding manual trigger node for testing n8n sub-workflow

Next we should do the trick - add two Edit Fields (Set) nodes, one is for test input and the other one will combine the input from both triggers:

Adding two set nodes to combine test and main workflow input

Specify color field with some test value in Test Input node:

Adding field for testing in n8n sub-workflow

And include all the input fields in Combine Input node:

Allowing all the input fields in set node of n8n sub-workflow

Let's try to execute this n8n sub-workflow:

Executing n8n sub-workflow to test

And check the input of the last node:

Checking the input of the last node of n8n sub-workflow after executing test

So you can see the same color field value we specified in Test Input node as Combine Input node output. If we execute this sub-workflow by the main n8n workflow with some color input it will be available in Combine Input node output as well.

Regardless the way we trigger our sub-workflow (manually or by main workflow) Combine Input node will always have color field value (testing value or real input from the main n8n workflow).

In further nodes you can use Combine Input node to refer to input values:

Checking value from Combine Input node output in n8n sub-workflow

You can find the template for the described approach here.