# How to pass a csv in collection runner which starts with 0's

**URL:** <https://community.postman.com/t/how-to-pass-a-csv-in-collection-runner-which-starts-with-0s/14422>\
**Category:** Help Hub\
**Tags:** variables, collections\
**Created:** [July 23, 2020, 6:54pm UTC](https://community.postman.com/t/how-to-pass-a-csv-in-collection-runner-which-starts-with-0s/14422 "2020-07-23T18:54:31Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![sujithkumar.matharas](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@sujithkumar.matharas](https://community.postman.com/u/sujithkumar.matharas)\
**Post date:** [July 23, 2020, 6:54pm UTC](https://community.postman.com/t/how-to-pass-a-csv-in-collection-runner-which-starts-with-0s/14422/1 "2020-07-23T18:54:31Z")

</div>

I am using collection runner to run a GET command which uses a variable. I have the code ready and running for multiple values in the variable. Now i am trying to use collection runner and import a csv file to get the input values . This runs fine when my input id starts with 1 or something but it fails when my input id starts with 0 .For all inputs with 0 it takes from the next value and fails , how can i get rid of this error? My csv file if i open it on notepad i can see the leading zeros in there.

Thanks,  
Sujith

---

<div class="post-metadata">

**Author:** ![sujithkumar.matharas](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@sujithkumar.matharas](https://community.postman.com/u/sujithkumar.matharas)\
**Post date:** [July 23, 2020, 7:11pm UTC](https://community.postman.com/t/how-to-pass-a-csv-in-collection-runner-which-starts-with-0s/14422/2 "2020-07-23T19:11:55Z")

</div>

I tried using “01234” within the quotes and due to the quotes the runner reads it as %220123422% which is also not working in my case

---

<div class="post-metadata">

**Author:** ![SabriH](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@SabriH](https://community.postman.com/u/SabriH)\
**Post date:** [July 23, 2020, 7:45pm UTC](https://community.postman.com/t/how-to-pass-a-csv-in-collection-runner-which-starts-with-0s/14422/3 "2020-07-23T19:45:12Z")

</div>

Hey @sujithkumar.matharas,

I believe this is expected behaviour because the number without quotes is converted to a Javascript Number when the CSV gets parsed in the Postman app. You cannot store a number with a leading zero in Javascript. You can replicate this behaviour in the Chrome Console:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/d/7/d7f194ad044a30120afcbc204f64504a251c0b77.png)  
Thus why wrapping the number in quotes should typically help here because it’s treated as a String. There’s some context here, if needed: [Runner Removes leading 0's from .csv data · Issue #2734 · postmanlabs/postman-app-support · GitHub](https://github.com/postmanlabs/postman-app-support/issues/2734#issuecomment-501155045).

Now regarding why it isn’t working for your particular use case, i.e. %220123422%, could you provide more information or screenshots about how you’re using this value? I just tried on my end by saving it to an Environment Variable and then referencing the variable as part of a URL param, and it worked but curious to get more details. Hopefully, the information provided helps.

---

<div class="post-metadata">

**Author:** ![sujithkumar.matharas](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@sujithkumar.matharas](https://community.postman.com/u/sujithkumar.matharas)\
**Post date:** [July 23, 2020, 8:12pm UTC](https://community.postman.com/t/how-to-pass-a-csv-in-collection-runner-which-starts-with-0s/14422/5 "2020-07-23T20:12:51Z")

</div>

Hi Sabri,

I stored the values in my csv file as  
“NI603160”  
“10090260”  
“03830539”  
with header companies which is my variable and when i pass this file in collection runner i get this error

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/3/d/3dd17bf5ddf21a0b932a7a8486d92ca8a3ef52dd.png)

So if you see in the error after gb it has %22 before our provided ID because of the quotes.

just to add to this, i dont have anything in my body & pre-request script however i have this in my tests code  
pm.test(“Body contains companies”, function () {

```
pm.expect(pm.response.text()).to.include(pm.iterationData.get("companies"));

// older syntax still works too: with dot or bracket notation

pm.expect(pm.response.text()).to.include(data.companies); 

console.log("companies to be sent: " + data["companies"]); 

```

});

to loop through all id’s and i havent declared any variable in global or environments

---

<div class="post-metadata">

**Author:** ![kevin.swiber](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kevin.swiber/32/3820_2.png) [@kevin.swiber](https://community.postman.com/u/kevin.swiber)\
**Post date:** [July 23, 2020, 8:49pm UTC](https://community.postman.com/t/how-to-pass-a-csv-in-collection-runner-which-starts-with-0s/14422/6 "2020-07-23T20:49:18Z")

</div>

Hi @sujithkumar.matharas,

How are you setting the URL? When I include quotes around the item in the CSV file, it resolves as a string with `pm.iterationData.get('companies')`. It looks like the error you’re getting is coming from the URL containing quotes. I’m wondering if those quotes are sneaking in via some other way. If I include `{{companies}}` as a variable in the URL, that’s also resolving correctly. Are you using that variable syntax in the URL address bar or are you setting the URL in a pre-request script via `pm.request.url`?

Best,

Kevin

---

<div class="post-metadata">

**Author:** ![kevin.swiber](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kevin.swiber/32/3820_2.png) [@kevin.swiber](https://community.postman.com/u/kevin.swiber)\
**Post date:** [July 23, 2020, 9:46pm UTC](https://community.postman.com/t/how-to-pass-a-csv-in-collection-runner-which-starts-with-0s/14422/7 "2020-07-23T21:46:33Z")

</div>

@sujithkumar.matharas,

One more thing. I’d make sure your quotes aren’t getting escaped in the CSV file. It should look like `"01234"` in the raw CSV file, not `"""01234"""`.

Best,

Kevin

---

<div class="post-metadata">

**Author:** ![sujithkumar.matharas](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@sujithkumar.matharas](https://community.postman.com/u/sujithkumar.matharas)\
**Post date:** [July 24, 2020, 6:31pm UTC](https://community.postman.com/t/how-to-pass-a-csv-in-collection-runner-which-starts-with-0s/14422/8 "2020-07-24T18:31:37Z")

</div>

i was using “01234” in this format only but it wasnt working, so i used online csv to json convertor and then uploaded the json file which ran fine.

---

<div class="post-metadata">

**Author:** ![arjunmarati](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@arjunmarati](https://community.postman.com/u/arjunmarati)\
**Post date:** [October 21, 2020, 8:57am UTC](https://community.postman.com/t/how-to-pass-a-csv-in-collection-runner-which-starts-with-0s/14422/9 "2020-10-21T08:57:23Z")

</div>

This is a very common scenario to have leading zeroes in imported data variables.  
I’m surprised why postman didn’t resolve this yet.  
As a temporary solution, I am converting CSV to JSON and running all my data driven tests (yes, this is cumbersome way but no other option).

Thanks,  
Arjun Marati

---

<div class="post-metadata">

**Author:** ![katealsha](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@katealsha](https://community.postman.com/u/katealsha)\
**Post date:** [November 11, 2022, 11:46am UTC](https://community.postman.com/t/how-to-pass-a-csv-in-collection-runner-which-starts-with-0s/14422/10 "2022-11-11T11:46:33Z")

</div>

I know i’m a couple of years late, but incase anyone else comes across this. This is how I got around it (Mine was always a pre-fixed length):

var policyno = data[‘PolicyNo’].toString()  
if(policyno.length \< 12){  
policyno = ‘0’+ policyno  
pm.variables.set(“PolicyNo”,policyno)  
}

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [September 18, 2023, 3:56pm UTC](https://community.postman.com/t/how-to-pass-a-csv-in-collection-runner-which-starts-with-0s/14422/11 "2023-09-18T15:56:52Z")

</div>

A fix was added to the latest version (10.18) which handles the issue with leading zeros.

You can read more about that here:

> <https://github.com/postmanlabs/postman-app-support/issues/2734#issuecomment-1723384860>
>
> Postman Runner Removes leading "0" from values in .csv spreadsheet. 
> 
> This cau…ses tests to fail unless I create a new var, append a 0 then test against the new var.
> 
> !\[excelview\](https://cloud.githubusercontent.com/assets/10963335/23161300/85e65eb0-f821-11e6-8bc5-20ba03414391.JPG)
> !\[preiviewvie\](https://cloud.githubusercontent.com/assets/10963335/23161310/8df5a052-f821-11e6-9988-0aab51dc7371.JPG)
> 
> Postman for Windows
> Version 4.10.2
> win32 10.0.14393 / x64
> 
> 
> There is reference to a similar issue here that was closed but it does not seemed to have been resolved
> 
> https://github.com/postmanlabs/postman-app-support/issues/1917#issuecomment-200397668

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [September 18, 2023, 3:57pm UTC](https://community.postman.com/t/how-to-pass-a-csv-in-collection-runner-which-starts-with-0s/14422/12 "2023-09-18T15:57:20Z")

</div>

Closed on September 18, 2023, 3:57pm UTC


