# Switch node distribute data

**URL:** <https://community.n8n.io/t/switch-node-distribute-data/35939>\
**Category:** Questions\
**Tags:** switch\
**Created:** [January 26, 2024, 4:39pm UTC](https://community.n8n.io/t/switch-node-distribute-data/35939 "2024-01-26T16:39:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_M](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/tom_m/32/33850_2.png) [@Tom\_M](https://community.n8n.io/u/Tom_M)\
**Post date:** [January 26, 2024, 4:39pm UTC](https://community.n8n.io/t/switch-node-distribute-data/35939/1 "2024-01-26T16:39:53Z")

</div>

I’d like to ask for some assistance because I can’t think of a way to do it myself. I make a call to API that returns me a JSON string that looks something like this

```auto
[
  {
    "id": 1,
    "name": "Some Guy 1",
    "task": "Some Task 1",
    "email": "some.email.1@domain.com",
  },
  {
    "id": 2,
    "name": "Some Guy 1",
    "task": "Some Task 2",
    "email": "some.email.1@domain.com",
  },
  {
    "id": 3,
    "name": "Some Guy 2",
    "task": "Some Task 3",
    "email": "some.email.2@domain.com",
  },
  {
    "id": 4,
    "name": "Some Guy 3",
    "task": "Some Task 4",
    "email": "some.email.3@domain.com",
  }
]

```

The goal is to group this data by name convert it to HTML table and send that table to each person. In this exact example there would be three emails sent.

If I were to write every possible user/email in Switch node I know how to do it. The problem is this user/email list can change over time and I don’t want to come back to edit Workflow each time new user is added to the system. Is there a way to configure Switch node so that it would distribute data dynamically? If there is can someone please show me an example.

## Information on your n8n setup

- **n8n version:** 1.20.0

---

<div class="post-metadata">

**Author:** ![n8n](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/n8n/32/26906_2.png) [@n8n](https://community.n8n.io/u/n8n)\
**Post date:** [January 26, 2024, 4:39pm UTC](https://community.n8n.io/t/switch-node-distribute-data/35939/2 "2024-01-26T16:39:54Z")

</div>

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:**

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [January 26, 2024, 4:59pm UTC](https://community.n8n.io/t/switch-node-distribute-data/35939/3 "2024-01-26T16:59:50Z")

</div>

Hey @Tom_M,

Just to check are you trying to send name 1 only the 2 values for them and name 2 the value for them and name 3 the one for them?

---

<div class="post-metadata">

**Author:** ![Tom\_M](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/tom_m/32/33850_2.png) [@Tom\_M](https://community.n8n.io/u/Tom_M)\
**Post date:** [January 26, 2024, 5:31pm UTC](https://community.n8n.io/t/switch-node-distribute-data/35939/4 "2024-01-26T17:31:39Z")

</div>

Yes.

Basically there can be X amount if users. I want to send each user one email that contains tasks assigned to that person. So in my example above there would be 3 emails send. Person 1 would receive table with two rows. Person 2 would receive table with one row. And person 3 would receive table with also one row.

---

<div class="post-metadata">

**Author:** ![Tom\_M](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/tom_m/32/33850_2.png) [@Tom\_M](https://community.n8n.io/u/Tom_M)\
**Post date:** [March 15, 2024, 12:35pm UTC](https://community.n8n.io/t/switch-node-distribute-data/35939/5 "2024-03-15T12:35:56Z")

</div>

I can’t seem to find any examples that would solve my issue. Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [March 25, 2024, 4:45pm UTC](https://community.n8n.io/t/switch-node-distribute-data/35939/7 "2024-03-25T16:45:12Z")

</div>

Hey @Tom_M,

What about something like this…

This will result in 3 emails being sent each one containing a table with the task name in it, As an exampl some.email.1 gets an email like this…

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/7/c/7c88c26ec341854e91e05bba9715f20ce968d031.jpeg)

---

<div class="post-metadata">

**Author:** ![Tom\_M](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/tom_m/32/33850_2.png) [@Tom\_M](https://community.n8n.io/u/Tom_M)\
**Post date:** [March 26, 2024, 9:11am UTC](https://community.n8n.io/t/switch-node-distribute-data/35939/8 "2024-03-26T09:11:42Z")

</div>

Thank you @Jon!

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [March 26, 2024, 10:25am UTC](https://community.n8n.io/t/switch-node-distribute-data/35939/9 "2024-03-26T10:25:05Z")

</div>

No problem, Is that the sort of thing you were after? It was easier to not use a switch node and make the most of looping.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/36532_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [April 2, 2024, 10:25am UTC](https://community.n8n.io/t/switch-node-distribute-data/35939/10 "2024-04-02T10:25:22Z")

</div>

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