Answers.Body: <p>This isn't really a CiviCRM issue, but it is helpful for getting data into CiviCRM or any system like it.</p>
  
  <p>A postal code is a string of text despite looking (in most of the US) like an integer.  A spreadsheet program doesn't know this, however, so it will save <code>012345</code> as <code>12345</code> by default.</p>
  
  <p>If you're using a spreadsheet program to edit a file for import, just precede the zip code with a single quote (<code>'</code>).  It will disappear, but the zip code will be interpreted as a string of text.</p>
  
  <p>If you have a whole column of zip codes that are appearing as integers, you should insert a new column and use a function to rewrite the ones that are wrong.  In LibreOffice, if you have the original zipcodes in column A, you'd enter the following formula in row 2 of your new column:</p>
  
  <pre><code>=IF(A2&gt;9999,A2,"0"&amp;A2)
  </code></pre>
  
  <p>Basically, it tacks a <code>0</code> on the front of the value if it's 9999 or lower.</p>
  
  <p>Finally, if you're assembling a CSV from scratch, just be sure to quote the zip codes that have leading zeroes.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-15T13:50:37.003Z
Answers.LastActivityDate: 2016-06-15T13:50:37.003Z
Answers.UserDisplayName: Andie Hunt
Answers.Body: <p>When setting up the CSV file, make sure that the zip code (and zip code suffix) columns are defined as TEXT format columns, and that the keyed-in / imported data has the appropriate leading zeros.  Then the export / upload processes should work as expected.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-29T22:10:58.150Z
Answers.LastActivityDate: 2016-06-29T22:10:58.150Z
Answers.UserDisplayName: dvhirst
Body: <p>When attempting to upload a CSV file containing zip codes with a leading zero the leading zero is dropped when attempting to save the file for import. How do I keep a leading zero in a CSV import file? </p>
  
Tags: <import>
Title: Upload CSV zipcode
ThreadText: # Upload CSV zipcode
  
  (Asked by: username_0 on 2016-06-15)
  
  When attempting to upload a CSV file containing zip codes with a leading zero the leading zero is dropped when attempting to save the file for import. How do I keep a leading zero in a CSV import file?
  
  **Tags:** import
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-06-15. Score: 2
  
  This isn't really a CiviCRM issue, but it is helpful for getting data into CiviCRM or any system like it.
  
  A postal code is a string of text despite looking (in most of the US) like an integer. A spreadsheet program doesn't know this, however, so it will save `012345` as `12345` by default.
  
  If you're using a spreadsheet program to edit a file for import, just precede the zip code with a single quote (`'`). It will disappear, but the zip code will be interpreted as a string of text.
  
  If you have a whole column of zip codes that are appearing as integers, you should insert a new column and use a function to rewrite the ones that are wrong. In LibreOffice, if you have the original zipcodes in column A, you'd enter the following formula in row 2 of your new column:
  
  ```
  =IF(A2>9999,A2,"0"&A2)
  
  ```
  
  Basically, it tacks a `0` on the front of the value if it's 9999 or lower.
  
  Finally, if you're assembling a CSV from scratch, just be sure to quote the zip codes that have leading zeroes.
  
  
  ---
  
  ### Answer by username_2 on 2016-06-29. Score: 0
  
  When setting up the CSV file, make sure that the zip code (and zip code suffix) columns are defined as TEXT format columns, and that the keyed-in / imported data has the appropriate leading zeros. Then the export / upload processes should work as expected.
  
  
  ---
  
  