Help with CSV data variable import

so i have been fiddling around with postman trying to make it so i can run one of my requests through the collection runner as a way to start automation. I was making significant progress until postman started importing one of my variables in the format i expected it too. the variable in question, zipcodevar, is supposed to hold a zip code which needs to be a 5-digit number or sting made up of numbers.

the problem i am having is that when i import the zip code from a csv file, it drops the leading zero in zip codes that start with a 0, take the Boston zip code 02135 for example, it would instead see 2135 as the value being used by postman for the request. this happens when i treat the variable as a string or number when using postman’s collection runner

@research-architect-5 Welcome to the community :bouquet:

You can try wrapping them in double quotes. Please spare a moment to read this post.

Hope this helps :slight_smile:

Hi Don Stevenson , so is it via running collection in runner if in case yes use the
pm.iterationData.get(“Zipcode”)[this should be same as the name in csv cell name ] in prerequest to autofill and pass the replace in body as

{
“name”:“Boston”
“Zipcode”:"{{csvcellname}}"
}
or other way is in excel while saving excel

  1. Click on Export icon > Export Data to CSV and the Save as CSV Options box opens.
  2. Set the Text qualifier as either double or single quotes.
  3. Set the Column delimiter as a comma.
  4. Click OK.
  5. Click Save – DO NOT OPEN THE CSV FILE DIRECTLY WITH EXCEL!
  6. Open a new worksheet in Excel (see below for Excel screenshots.)
  7. Select the Data tab.
  8. Click on the From text icon to display the Import Text File dialog box.
  9. Select the CSV file to import and click Import. The Text Import Wizard appears.
  10. Select the Delimited radio button – Text Import Wizard, Step 1 determines that your data is delimited.
  11. Select the row number where you want the import to start.
  12. Check the My data has headers. box if true. Review the preview of the file at the bottom of the box.
  13. Click Next
  14. Check “Comma” as a delimiter (column dividers will appear in preview)-- Step 2 lets you set delimiters
  15. Click Next
  16. Highlight the column(s) with leading zeros in Step 3
  17. Mark those columns format as “text” by clicking the radio button in the Column Data Format section. NOTE: You will need to do this for each column where the data contains leading zeros.
  18. Click Finish, Import Data dialog box opens.
  19. Click OK.
  20. The leading zeros will still be there in the new worksheet with the imported data. The columns with real numbers will still be able to be used with calculations.

Hope this will work :slight_smile:

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

You can read more about that here: