Loop over items from multiple google sheets [Looping issue]

Loop over items from google sheet is processing only the first sheet.

Current I have 2 sheets: Sheet1, Sheet2 and each of them have identical data in each rows.

Sheet1: 5 records
Sheet2: 6 records

The problem:

Loop Over Rows node doesn’t loop throw items from the second sheet. Instead it executes the Done branch.

Thank you so much in advance for your help :pray:

My workflow

Screenshot of the Loop output that went through the “Done” branch instead of looping through the items from the second sheet.

Records in google sheet

Information on your n8n setup

  • n8n version: 1.82.3
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via : n8n cloud

@ThinkBot Sorry for tagging you here but I really hope you have an answer for this.

Hey, I think you have the items of your other sheets but it is on the other page, also, it’s likely that you have duplicate data because you link the done of the second loop to your first loop.

Here’s a way to avoid that :
(the split node is doing what your code node does)

You might not need the second loop as n8n already treat items sequentially, so you can do this :

Hope this helps ! :slight_smile:

Thank you so much @lugnicca!
The first solution does the job but it processes all of the records together. Is there anyway I can force it to process all the rows from the first sheet only after that it should read the second sheet and process it’s records?

The reason is, we need to update the record in the same sheet based on different conditions.

If we process all records together, how would we know from which sheet this row/record is coming from?

Hey ! You could add the info for each row, like this :

1 Like

@lugnicca Thanks again for your solution and I really appreciate your help. This solves the issue of getting the sheet name for each rows.

But I am still interested in learning how to process one sheet at a time before proceeding to the next sheet.

1 Like

You can tag me in the future no problem! But glad someone else was able to get there first! :pray:

Thank you so much for your reply @ThinkBot

But I am still interested in learning how to process records of one sheet at a time before proceeding to the next sheet?

As n8n process items sequentially, you can just treat each item in the same flow without adding another loop, so each row will be treated in order of the sheet :
You can test it :slight_smile: :

If you really want to do a loop, the way I would see would be to call a subworkflow that will loop through your items.

3 Likes

@lugnicca Thank you so much for your help!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.