Sunday, July 20, 2025

Tip #6: Preventing simultaneous executions of scheduled workflow

Let's assume you have n8n workflow which is managed by Google Sheet similar to the approach described in my previous posts Tip #2: Using Google Sheets as UI for your n8n workflow and Tip #5: Fixing Google Sheets quota exceeding issue. So you have big and dynamic amount of rows with different statuses and your workflow should automatically process with them accordingly.

In this case pretty good solution could be:

  1. Scheduling workflow to execute at some small time intervals (i.e. every 5 minutes) so the maximum delay between your change in Google Sheet and workflow execution will be small enough.
  2. Processing rows in a loop so one execution will process more than one row.
  3. Updating Google Sheet right after each row processed so you will not loose previous rows data in the case of error.

So let's start from the workflow from Tip #5: Fixing Google Sheets quota exceeding issue:

Starting with n8n workflow which updates Google Sheet rows in a loop

Add Wait node with random wait amount to slow down execution a bit for demonstration purposes:

Adding Wait node with random wait amount in n8n

And also replace Manual Trigger node by Schedule Trigger node with trigger interval of 5 minutes:

Adding Schedule Trigger node with trigger interval of 5 minutes in n8n

So finally our workflow should look like this:

Finally our n8n workflow should look like this

Now we are ready to execute our n8n workflow and see. At some point there are two concurrent executions which actually do the same job:

Two concurrent executions of n8n workflow which do the same job

So the last thing to do is to set workflow timeout to the same value as scheduling interval:

Setting n8n workflow timeout to prevent concurrent executions

Let's check again. Now we can see that there are no more concurrent executions:

There are no more concurrent executions of n8n workflow

And once the previous execution did some job, the next execution will continue with the row where the previous one was stopped:

Google Sheet for managing n8n workflow

So that's the idea to use scheduling and timeout with the same time interval. Works nicely!

You can find the template for the described approach here.

Saturday, July 12, 2025

Tip #5: Fixing Google Sheets quota exceeding issue

Let's say you have Google Sheet and n8n workflow which works with it similar to the approach described in Tip #2: Using Google Sheets as UI for your n8n workflow. The only difference is that the volume of data is much bigger and you don't want to wait until all the data processed and update Google Sheet row by row instead. In this case you need to move the related Google Sheets node into the loop:

Updating Google Sheet row by row in n8n

And add some more data to Google Sheet:

Adding more data to Google Sheet to test n8n workflow

Let's execute it now. So it failed after processing of some number of items with the error message like "The service is receiving too many requests from you":

Execution of n8n workflow failed due to Google Sheets quota exceeding issue

What we can do here? Let's use retry/delay approach described in Tip #3: Retry/delay more than 5 seconds/5 tries adding Wait nodes to error outputs of both Google Sheets nodes:

Adding retry/delay approach to Google Sheets nodes in n8n

Wait amount can be 1 minute:

Wait node with wait amount 1 minute in n8n

It's time to execute our workflow and see how it works:

Retry/delay approach for Google Sheets nodes works well in n8n

Passed successfully. Also we can see that Wait node was executed 1 time so this approach works well.

Google Sheet for this tip is available here as well as n8n template.

Sunday, July 6, 2025

Tip #4: Nested loops in n8n

Let's imagine you have some set of data like colors and you want to iterate over all of them. For illustration I will create this data set using Code node:

Creating a data set of colors for outside loop in n8n

And after that I will add a Loop node:

Adding outside loop node in n8n

After executing a workflow we can see 3 items in Done Branch as expected:

Getting color items in Done Branch of outside loop in n8n

Ok, let's now imagine that we have some another data set like integer numbers and we also want to iterate over all of them in a nested loop. I will create another Code node for this:

Creating a data set of integers for nested loop in n8n

And again I will add a nested Loop node:

Adding nested loop node in n8n

And finally let's add Set node to a nested loop to show the current values of color and integer number:

Adding Set node to the nested loop to show the current values of both loops in n8n

The final workflow should look like this:

The final workflow to illustrate nested loops in n8n

Now let's execute the workflow and check the results. What we can see is that outside loop's Done Branch has 18 items and the values are quite odd:

Odd results of using nested loops in n8n

This is not we were expecting though. It looks like nested loops are not supported according to the comment of n8n team. But there is a workaround - let's move the body of outside loop to a separate sub-workflow:

Moving outside loop body to a separate sub-workflow in n8n

It should have "color" input parameter:

Adding color input parameter to a sub-workflow in n8n

And it also requires the change in Set node - we don't have outside loop here but have sub-workflow input instead:

Changing Set node in a nested loop in n8n

Then get back to the main workflow and add Execute Sub-workflow node to call our sub-workflow with a nested loop:

Calling a sub-workflow with a nested loop in n8n

Pass the color from the outside loop as an input parameter of sub-workflow:

Passing color value from the outside loop as an input parameter of a sub-workflow in n8n

It's time to test it. Let's execute the main workflow and check the results:

Checking the results of using nested loops workaround in n8n

This is exactly what we were expecting to see. So for nested loops in n8n it's possible to use sub-workflow workaround.