Retrieve values from a file for pre-request


I’m running via a “runner” and need to retrieve a value from the input file .csv to manipulate it before the final execution.

My file has this information:


I need to retrieve only the first 6 characters from the “data” field:

var data = pm.iterationData.get(“data”);
var slicedData = data.substring(0, 6);
pm.environment.set(“sliced”, slicedData);

Then I can use it in the final request.


But still, I’m unable to do it… the value isn’t retrieved from the file.

You can use the special data variable which will have a JSON representation of the current iteration\line in the CSV file.

Try the following…

console.log(data); // json representation of the current line of your CSV
console.log(; // this should be your data column from the CSV file.
console.log(, 6));
pm.environment.set("sliced",, 6));

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