Get variable from collection runner data file

Dear community,

I´ve got a question regarding the data file in a collection runner. Is it possible to use the value of a csv file in the pre-request script?

So in my case: If the value of variable from Data file (csv) is empty -> skip this request

“if (postman.getEnvironmentVariable(“Variable from data csv file”)===’’){
postman.skipRequest;
}”

Thanks and regards
Philipp

Hey Phillip,

Yep! :slight_smile:
https://learning.getpostman.com/docs/postman/scripts/postman-sandbox-api-reference/#pmiterationdata

The exact method for getting a value would be pm.iterationData.get('variable_name');

1 Like