title: JMETER: Need to send all entries in a CSV file to HTTP request body in 'one' request
body: <p>I'm trying to solve a test data issue in Jmeter. Can anyone of you have a look at below problem statement and advise here please ?</p>
  <p><strong>Requirement:</strong> Need to send all entries in a CSV file to HTTP request body in <strong>'one'</strong> request to the end point.</p>
  <p>Example CSV File:</p>
  <pre><code>&quot;adsfas123wsf00000wqefqwe52145t10000&quot;,
  &quot;fdfrgvergq120947r0000dwsfqwaef237sadf&quot;,
  &quot;wfrqwef7865034r78tkahsefjh6985r7asfdaf&quot;,
  &quot;qefqwe52145t10000adsfas123wsf00000w&quot;,
  &quot;wsfqwaef237sadffdfrgvergq120947r0000d&quot;
  </code></pre>
  <p><strong>HTTP Request Body</strong>:
  [&quot;${data}&quot;}]</p>
  <p>When the data is substituted, I should be able to get below output.</p>
  <pre><code>[
  &quot;adsfas123wsf00000wqefqwe52145t10000&quot;,
  &quot;fdfrgvergq120947r0000dwsfqwaef237sadf&quot;,
  &quot;wfrqwef7865034r78tkahsefjh6985r7asfdaf&quot;,
  &quot;qefqwe52145t10000adsfas123wsf00000w&quot;,
  &quot;wsfqwaef237sadffdfrgvergq120947r0000d&quot;
  ]
  </code></pre>
  <p>Problem Statement: When I use CSV data set config. file, I'm unable to concatenate all entries into one single request body. My understanding is, CSV data set config. the file is not the right option here.</p>
  <p>Did some search in StackOverflow and followed a method to achieve above using JSR223 PreProcessor' and the link is, <a href="https://stackoverflow.com/questions/55235024/how-to-send-multiple-json-body-using-jmeter">How to send multiple json body using jmeter?</a>.</p>
  <p>Followed the above link and tried added below custom code provided.</p>
  <pre><code>def builder = new StringBuilder()
  new File('/path/to/plans.csv').readLines().each { line -&gt;
      builder.append(new File(line).text).append(System.getProperty('line.separator'))
  }
  sampler.getArguments().removeAllArguments()
  sampler.addNonEncodedArgument('', builder.toString(), '')
  sampler.setPostBodyRaw(true)
  </code></pre>
  <p>Upon running, I get below error message,</p>
  <pre><code>Caused by: java.io.FileNotFoundException,
  &quot;adsfas123wsf00000wqefqwe52145t10000&quot;,
  &quot;fdfrgvergq120947r0000dwsfqwaef237sadf&quot;,
  &quot;wfrqwef7865034r78tkahsefjh6985r7asfdaf&quot;,
  &quot;qefqwe52145t10000adsfas123wsf00000w&quot;,
  &quot;wsfqwaef237sadffdfrgvergq120947r0000d&quot; (The filename, directory name, or volume label syntax is incorrect)
  </code></pre>
  <p>If the file is not found, then how come the entries are read and displayed in the log viewer?</p>
  <p>Also, how do I link the output of custom code to the request body? Or is it taken care of by the custom code itself?</p>