Loop and Google sheet

Hi Everyone,

I’ve got a workflow where an HTTP request returns a JSON array of items. I feed that into a Loop node to process each item: for every item, I check if it exists in an Excel sheet; if not, I add it. The problem: the loop only runs as many times as there are rows in the Excel sheet, not as many as there are items in the JSON. Has anyone run into this? How do I fix it?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.108.1,
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Podman
  • Operating system: Debian-based

Hey @And, hope all is well. Welcome to the community.

Could you provide an example of the input JSON array?

[
  {
    "id": "ANmpCGjtkkV3",
    "key": "r59M2k",
    "startTime": "2025-08-26T16:39:31.199Z"
  },
  {
    "id": "y2nlPyEaIRzC",
    "key": "xWPN28",
    "startTime": "2025-08-27T06:54:54.924Z"
  },
  {
    "id": "NzLA1O2343T3",
    "key": "wpUP6i",
    "startTime": "2025-08-27T16:04:36.376Z"
  },
  {
    "id": "QVXeR3dBJptz",
    "key": "Sf0cBE",
    "startTime": "2025-08-28T10:03:06.443Z"
  },
  {
    "id": "HktGcbZuh1NC",
    "key": "RI6UrJ",
    "startTime": "2025-08-28T15:02:10.843Z"
  },
  {
    "id": "yrAFSeMxyUmt",
    "key": "ldZGN3",
    "startTime": "2025-08-29T15:20:56.430Z"
  },
  {
    "id": "a0hCLA6HsmTz",
    "key": "ZafJPu",
    "startTime": "2025-08-30T07:41:39.223Z"
  },
  {
    "id": "Ypt4bCWX86Xl",
    "key": "blcwdc",
    "startTime": "2025-08-30T09:01:12.779Z"
  },
  {
    "id": "6fxUY0ZPmtbK",
    "key": "wU4oMk",
    "startTime": "2025-08-30T13:52:37.927Z"
  },
  {
    "id": "HZEkcy5fP3ed",
    "key": "j0fYg9",
    "startTime": "2025-08-30T18:40:56.796Z"
  },
  {
    "id": "831FDetgPdsV",
    "key": "pPpfUl",
    "startTime": "2025-08-31T09:27:26.759Z"
  },
  {
    "id": "JIHw8ghjIr6X",
    "key": "8Io9q2",
    "startTime": "2025-09-01T07:34:37.474Z"
  },
  {
    "id": "lASdrzeGcs3j",
    "key": "m1pM3l",
    "startTime": "2025-09-01T14:59:23.719Z"
  },
  {
    "id": "xQV4ErRYDmkw",
    "key": "4GcZ0-",
    "startTime": "2025-09-05T16:05:16.487Z"
  },
  {
    "id": "99DiP5J4wSls",
    "key": "bZXpGo",
    "startTime": "2025-09-06T09:28:06.923Z"
  },
  {
    "id": "0RMVvTvboPMn",
    "key": "931g4d",
    "startTime": "2025-09-07T07:54:04.043Z"
  },
  {
    "id": "hxTaJOLngSNX",
    "key": "fTPhac",
    "startTime": "2025-09-07T15:28:01.192Z"
  },
  {
    "id": "KvTHYAVEOC0l",
    "key": "QI0C65",
    "startTime": "2025-09-08T15:34:53.811Z"
  }
]

Hi @jabbson, here you go!

The issue come from the configuration of the first Sheets node, if it finds the row it produces no results and the next node never executes. Try to enable the following setting:

Always output data will produce an “empty” result which will maintain the flow.

Hi @jabbson That indeed did the trick, thank you so much!! I am struggling to understand how this works though. I am used to work with loops in python, C and bash in general so I’d expect this one to continue regardless what happens in the G Sheet node. Do you mean that it if there is no rows, it interrupts the flow of the loop?

Exactly, the flow only continues as nodes receive inputs. If when searching for rows no rows are found, there is no output from that node, which means there is no input for the next node and it is never ran.

Hope it helped.
If so, kindly mark my answer as Solution. Thank you.
Cheers.

1 Like

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