Google sheets only adds one row from multiple JSON objects input?

Hey there guys,

I have the input below that I want to add to multiple rows in Google Sheets:

[
  {
    "data": [
      {
        "key1": "info 1",
        "key2": "info 2",
        "key3": "info 3",

      },
      {
        "key1": "info 4",
        "key2": "info 5",
        "key3": "info 6",

      },
      {
        "key1": "info 7",
        "key2": "info 8",
        "key3": "info 9",

      }
    ]
  }
]

My understanding is that in order for Google sheets to add all of these to multiple rows in one go, I must convert it it to this format:

[
      {
        "key1": "info 1",
        "key2": "info 2",
        "key3": "info 3",

      },
      {
        "key1": "info 4",
        "key2": "info 5",
        "key3": "info 6",

      },
      {
        "key1": "info 7",
        "key2": "info 8",
        "key3": "info 9",

      }
]

Am I understanding this correctly? I’ve been banging my head trying to do this with the “Edit Fields” node but can’t seem to be able to do it. Am I missing something? Or does this sort of thing need a code node?

Thank you so much!

1 Like

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

You need to use the Split Out node to split the array into items, and then the Google Sheets node will run once for each item.

2 Likes

This was exactly what I needed, thanks a lot.

1 Like

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