# Error fetching data for text-field from csv file.

**URL:** <https://community.gatling.io/t/error-fetching-data-for-text-field-from-csv-file/1014>\
**Category:** Gatling (Open-Source)\
**Created:** [May 7, 2014, 9:03am UTC](https://community.gatling.io/t/error-fetching-data-for-text-field-from-csv-file/1014 "2014-05-07T09:03:22Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amar\_Pawar](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@Amar\_Pawar](https://community.gatling.io/u/Amar_Pawar)\
**Post date:** [May 7, 2014, 9:03am UTC](https://community.gatling.io/t/error-fetching-data-for-text-field-from-csv-file/1014/1 "2014-05-07T09:03:22Z")

</div>

Hi  
When I try to fetch text from csv file to be entered in a text field, I get following error & the request is getting failed.  
Contents of csv file:

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [May 7, 2014, 9:46am UTC](https://community.gatling.io/t/error-fetching-data-for-text-field-from-csv-file/1014/2 "2014-05-07T09:46:58Z")

</div>

You should probably using a Body instead of a form param.

.body(StrinBody("""{“name”:"${name}"}"""))

---

<div class="post-metadata">

**Author:** ![Amar\_Pawar](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@Amar\_Pawar](https://community.gatling.io/u/Amar_Pawar)\
**Post date:** [May 7, 2014, 10:04am UTC](https://community.gatling.io/t/error-fetching-data-for-text-field-from-csv-file/1014/3 "2014-05-07T10:04:18Z")

</div>

Thanx. It worked for me.  
But now I am not able to understand which parameters are being fetched.

Like previously it used to show :

params=  
{“name”:“test\_amar1”}: []

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [May 7, 2014, 10:13am UTC](https://community.gatling.io/t/error-fetching-data-for-text-field-from-csv-file/1014/4 "2014-05-07T10:13:42Z")

</div>

Because you were not really posting a regular form in the first place, you were actually posting a JSON payload.  
Request bodies can be huge and binaries instead of test, so we don’t log them.

---

<div class="post-metadata">

**Author:** ![Amar\_Pawar](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@Amar\_Pawar](https://community.gatling.io/u/Amar_Pawar)\
**Post date:** [May 9, 2014, 7:20am UTC](https://community.gatling.io/t/error-fetching-data-for-text-field-from-csv-file/1014/5 "2014-05-09T07:20:58Z")

</div>

Hi

.body(StringBody("""{“name”:"${name}",“type”:"${movie}"}""", “”""""))

While passing two parameters from csv file, it is giving me following error:

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [May 9, 2014, 7:27am UTC](https://community.gatling.io/t/error-fetching-data-for-text-field-from-csv-file/1014/6 "2014-05-09T07:27:45Z")

</div>

**too many arguments**

Why did you add a second parameter to StringBody???

.body(StringBody("""{“name”:"${name}",“type”:"${movie}"}""" **, “”""""** ))

---

<div class="post-metadata">

**Author:** ![Amar\_Pawar](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@Amar\_Pawar](https://community.gatling.io/u/Amar_Pawar)\
**Post date:** [May 9, 2014, 7:49am UTC](https://community.gatling.io/t/error-fetching-data-for-text-field-from-csv-file/1014/7 "2014-05-09T07:49:50Z")

</div>

Ohh sorry…  
Actually original simulation had :  
.param("""{“name”:“amar\_testplaylist1”,“type”:“movie”}""", “”""""))

So I didn’t notice while replacing it with code you suggested.

Thanks. 🙂

---

<div class="post-metadata">

**Author:** ![Amar\_Pawar](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@Amar\_Pawar](https://community.gatling.io/u/Amar_Pawar)\
**Post date:** [May 9, 2014, 9:08am UTC](https://community.gatling.io/t/error-fetching-data-for-text-field-from-csv-file/1014/8 "2014-05-09T09:08:32Z")

</div>

It is still giving me attribute not defined error:

.feed(csv(“playlist.csv”).circular)

.exec(http(“request\_110”)  
.post(""“[https://api-staging.ooyala.com/v2/playlists](https://api-staging.ooyala.com/v2/playlists)”"")  
.headers(headers\_37)  
.body(StringBody("""{“name”:"${name}",“type”:"${movie}"}""")))

14:31:39.430 [ERROR] i.g.h.a.HttpRequestAction - No attribute named ‘name’ is defined

[playlist.csv](https://community.gatling.io/uploads/short-url/uXx9uyoxxMy6ofdS9pBs3HSJv5s.csv) (813 Bytes)

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [May 9, 2014, 9:12am UTC](https://community.gatling.io/t/error-fetching-data-for-text-field-from-csv-file/1014/9 "2014-05-09T09:12:12Z")

</div>

Your file is not a CSV one. CSV means comma separated values.  
Your file uses 2 tabs which is just WTF.

Either use 1 single comma and csv(), or use 1 single tab and tsv().

---

<div class="post-metadata">

**Author:** ![Amar\_Pawar](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@Amar\_Pawar](https://community.gatling.io/u/Amar_Pawar)\
**Post date:** [May 9, 2014, 9:33am UTC](https://community.gatling.io/t/error-fetching-data-for-text-field-from-csv-file/1014/10 "2014-05-09T09:33:37Z")

</div>

Thanks a ton.

Finally got the way to write csv file. Got my misconceptions corrected.
