# Loop in data file

**URL:** <https://community.postman.com/t/loop-in-data-file/46435>\
**Category:** Help Hub\
**Created:** [April 17, 2023, 11:26am UTC](https://community.postman.com/t/loop-in-data-file/46435 "2023-04-17T11:26:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobocjusz](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@bobocjusz](https://community.postman.com/u/bobocjusz)\
**Post date:** [April 17, 2023, 11:26am UTC](https://community.postman.com/t/loop-in-data-file/46435/1 "2023-04-17T11:26:29Z")

</div>

Hello

I tried to find a solution in other topics but had no luck. I have to raise an API call into NSX-T to create a group.

Body of API call :

```auto
{
    "expression": [
        {
            "ip_addresses": [
                "{{members}}"
            ],
            "resource_type": "IPAddressExpression"
        }
    ],
    "resource_type": "Group",
    "display_name": "Test",
    "description": "{{group_name}}",
    "_system_owned": false,
    "_protection": "NOT_PROTECTED",
    "_revision": 0
}

```

I want to use csv file with the below structure

```auto
group_name,members
Test,1.1.1.1

```

And this is fine, but what to do if I have more members and the number of them is different in each row? CSV file for example:

```auto
group_name,members
Test,1.1.1.1, 2.2.2.2, 3.3.3.3
Test2,2.2.2.2, 3.3.3.3

```

---

<div class="post-metadata">

**Author:** ![arlem](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/arlem/32/3078_2.png) [@arlem](https://community.postman.com/u/arlem)\
**Post date:** [April 17, 2023, 12:57pm UTC](https://community.postman.com/t/loop-in-data-file/46435/2 "2023-04-17T12:57:24Z")

</div>

Hey @bobocjusz ,

This isn’t valid csv as the other members wouldn’t belong to any column. You’d need to either:

- have different member columns and leave them empty when there is only a few members, e.g.:

```plaintext
group_name,member1,member2, member3
Test,1.1.1.1, 2.2.2.2, 3.3.3.3
Test2,2.2.2.2, 3.3.3.3,,
Test3,1.1.1.1,,,

```

- use JSON instead of CSV so you can store more complex type of items like an array of members:

```json
[
 {
   "group_name": "Test",
   "members": ["1.1.1.1"," 2.2.2.2"," 3.3.3.3"]
 },
 {
   "group_name": "Test2",
   "members": ["2.2.2.2", "3.3.3.3"]
 }
]

```

---

<div class="post-metadata">

**Author:** ![bobocjusz](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@bobocjusz](https://community.postman.com/u/bobocjusz)\
**Post date:** [April 18, 2023, 2:24pm UTC](https://community.postman.com/t/loop-in-data-file/46435/3 "2023-04-18T14:24:41Z")

</div>

Thank you Arlemi for you support 🙂
