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
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
Click on Export icon > Export Data to CSV and the Save as CSV Options box opens.
Set the Text qualifier as either double or single quotes.
Set the Column delimiter as a comma.
Click OK.
Click Save – DO NOT OPEN THE CSV FILE DIRECTLY WITH EXCEL!
Open a new worksheet in Excel (see below for Excel screenshots.)
Select the Data tab.
Click on the From text icon to display the Import Text File dialog box.
Select the CSV file to import and click Import. The Text Import Wizard appears.
Select the Delimited radio button – Text Import Wizard, Step 1 determines that your data is delimited.
Select the row number where you want the import to start.
Check the My data has headers. box if true. Review the preview of the file at the bottom of the box.
Click Next
Check “Comma” as a delimiter (column dividers will appear in preview)-- Step 2 lets you set delimiters
Click Next
Highlight the column(s) with leading zeros in Step 3
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.
Click Finish, Import Data dialog box opens.
Click OK.
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.