I have extracted a value from JSON response of an API with jmeter let's call it ${newID}. Now I want to paste this newID in all the values of a column ID2 (image attached for reference). Then I need to pass the updated CSV as part of file upload to another API. I have just started using Jmeter, please let me know how I can perform file edit and upload with beanshell script or any other way with Jmeter.
CSV image
This is the script I've added in BeanShell post processor but it's not replacing the values:
`import org.apache.commons.io.FileUtils;
File csvFile = new
File("/my/file/path/dist.csv");
List lines = FileUtils.readLines(csvFile);
String row2 = lines.get(1);
String[] cells = row2.split(",");
String cell2 = cells[1]; //get the value of old storeID
String fileData = FileUtils.readFileToString(csvFile);
fileData = fileData.replaceAll(cell2, ${StoreID});
FileUtils.writeStringToFile(csvFile, fileData);`