Issue on append feature on "Merge node"

Hi my dear friends

In my case:

changer_008

  • I have 3 “set node” that they save some variable from different streams
  • I merge their results by “merge node”. It is possible that some of that variable or set nodes" be empty.
  • I save them into my database.

My problem is:
The variables that set from different stream save in separate rows.

While I want to save them in my database (google sheets) in just one row. (like below image)

Could anyone help me please?
Best regards;

Not sure if I understand you correctly. But it sounds like you simply want all the data of both inputs combined in one item after the merge?

If that is the case you can simple set the Merge-Node to “Merge By Index”. That one merges the data of both inputs by index. That means it takes the first item (index 0) of Input 1 and combines them with the first item of Input 2. Then it does the same with the second item (index 1) of Input 1 which it combines with the second item of Input 2, … and so on.

Here an example:

{
  "nodes": [
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "valueA",
              "value": "a"
            }
          ]
        }
      },
      "name": "SetA",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        600,
        250
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "valueB",
              "value": "b"
            }
          ]
        }
      },
      "name": "SetB",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        600,
        450
      ]
    },
    {
      "parameters": {
        "mode": "mergeByIndex"
      },
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 1,
      "position": [
        800,
        350
      ]
    }
  ],
  "connections": {
    "SetA": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SetB": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  }
}
1 Like