Loop through a csv file as variable

Hi All,
I’ve been searching for a day still can’t find the best way to do this. Hope someone can help me with this.
Basically the problem is. I have an API with Content-Type: application/x-www-form-urlencoded.
The request body is kind of like: TaskNo = abc12345
I can successfully post the API one by one by changing the TaskNo in the body myself. But I tried various ways to loop, all of then failed.

The input csv is like:
aaa11111,
bbb1111,
ccc2222
etc…

I want to loop each case as the variable in the body and post it. Is there a better way to do this job?
Thanks

Does your csv have a header? If not, you should add one so you can access these values as a variable.

Let’s say you add the TaskNo column header to your csv. In your request you could just add a variable in your form data like this:

If you start the collection runner, you will be able to select your csv with the Select File button and it will iterate over all the values for you.
image

1 Like