I’m trying to use the Loop Over Items node to go through each item coming from a Code node. The code splits some text into multiple rows (items), and I want to loop through each of them and write them one by one into a Google Sheet using the “Append row” node.
Later on, I plan to add more complex logic inside the loop, but for now, I just want to make sure it actually loops through all the items I provide.
Right now, it only runs once — it processes the first item, then stops. I tried adding a dummy node after the Google Sheets node to return the item back to the loop, but that didn’t help either.
How can I make Loop Over Items go through all the items I pass into it?
Thanks a lot for the response and for testing the flow!
Let me give you some more context so it’s clearer what I’m trying to achieve and what’s not working.
My workflow starts with a Gmail trigger. I receive an email that contains either a PDF or JPEG attachment. I extract text from the attachment, and at the end of the chain, I use a “Code” node to clean and split that text into multiple lines – one line per item (see screenshot).
Now I want to loop over each of these lines using the “Loop Over Items” node and append them one by one into a Google Sheet using the “Append row” node.
The Problem:
Even though the Code node clearly outputs 8 items, the Loop Over Items node only processes the first one, and then stops. It does not iterate through all 8 items.
What if you don’t use the loop over items node to begin with? Most nodes in n8n can process multiple items one by one on their own without needing to explicitly looping over them. try to connect the output of the code node directly to the Google Sheets node.
Thanks for the idea! I actually separated the logic and tested it by triggering the workflow with Gmail — and it works exactly as I want.
When triggered normally, everything loops correctly and writes to Google Sheets without issues. I just wanted to verify the loop behavior in isolation, but you’re right — in practice, I don’t even need the Loop Over Items node here.