# Validating responses against prewritten csv

**URL:** <https://community.postman.com/t/validating-responses-against-prewritten-csv/78308>\
**Category:** Help Hub\
**Tags:** tests, csvdatafile, data-driven\
**Created:** [April 9, 2025, 2:36pm UTC](https://community.postman.com/t/validating-responses-against-prewritten-csv/78308 "2025-04-09T14:36:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![knash](https://avatars.discourse-cdn.com/v4/letter/k/ac91a4/32.png) [@knash](https://community.postman.com/u/knash)\
**Post date:** [April 9, 2025, 2:36pm UTC](https://community.postman.com/t/validating-responses-against-prewritten-csv/78308/1 "2025-04-09T14:36:22Z")

</div>

Hello. I have a test that sends a request who has values set in a csv file. The application I’m testing will then perform a calculation and return a response containing several parameters in JSON. I have a second csv file that contains expected responses. How would I validate the response bodies of each iteration of the test against the expected results in the second csv?

For example: lets say the application multiplies the parameter “AMOUNT” from CSV 1 by 2 and returns the result. “EXTRA” has been added to take the place of other variables that are present, but not important for this specific test.  
CSV 1

```auto
|TEST ID|EXTRA|AMOUNT|
|ID1|0|1|
|ID2|0|2|
|ID3|0|3|

```

CSV 2

```auto
|TEST ID|EXTRA|AMOUNT|
|ID1|0|2|
|ID2|0|4|
|ID3|0|6|

```

So far I understand that to send the CSV 1 file on run I would select the file as a “Test data file”, and that by using `{{AMOUNT}}` in my request, I can have the test iterate through the rows for each run. Each of these runs correctly returns the responses I’m looking for.

I believe the script would look something like:

```auto
pm.expect(jsonData."location in response").to.include("value from CSV2")

```

How would I tell postman to check this second csv file and to understand to iterate through the rows for each test?

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [April 9, 2025, 2:47pm UTC](https://community.postman.com/t/validating-responses-against-prewritten-csv/78308/2 "2025-04-09T14:47:13Z")

</div>

Hey @knash 👋

Welcome to the Postman Community! :postman:

You can only use 1 datafile at a time, you’d need to run the Collection again with the second file. You could just extend the data file to include an expected results column and use that in the assertion.

---

<div class="post-metadata">

**Author:** ![knash](https://avatars.discourse-cdn.com/v4/letter/k/ac91a4/32.png) [@knash](https://community.postman.com/u/knash)\
**Post date:** [April 9, 2025, 2:55pm UTC](https://community.postman.com/t/validating-responses-against-prewritten-csv/78308/3 "2025-04-09T14:55:18Z")

</div>

Well that would explain why it’s been difficult to figure out. I’ll see if the preprocessing can be changed. Thank you.
