title: Import data from one CSV to another CSV in a specific column
body: <p>I'm having some trouble copying data from 1 CSV and pasting it into a template of another one.
  The template has specific column names.
  and the csv file I have with the data, I'm able to get each column, but I am having trouble pasting it into a the template.</p>
  
  <p>I'm trying to copy the following data from 1 csv to the template and here are the columns</p>
  
  <pre><code>email --&gt; internal_customer_ID  
  givenname --&gt; first_name
  surname --&gt; last_name
  mail --&gt; email_address
  mobilephone --&gt; mobile_phone_1
  officePhone --&gt; landline_phone_1
  </code></pre>
  
  <p>Here is my current code. </p>
  
  <pre><code>#Clear Screen
  CLS
  
  #The path we are working with (use the path where we execute this script from)
  $global:path = Split-Path $script:MyInvocation.MyCommand.Path
  
  $DataFile = $path + "\dataFile.csv"
  $ExportedFileCSV = $path + "\PopulatedTemplate.csv"
  
  #Export the data file with our user info
  Get-ADGroupMember -Identity SomeGroup | Get-ADUser -Properties * | Select-Object -Property GivenName, SurName, Mail, MobilePhone, OfficePhone | Export-Csv -path $DataFile -NoTypeInformation -Force
  
  $dataInput = Import-Csv $DataFile
  $dataOutput = Import-Csv $ExportedFileCSV
  
  $dataInput | ForEach-Object {
  
      $newData = $_
  
      $dataOutput | 
      Add-Member -MemberType NoteProperty -Name "internal_customer_ID" -Value $newData.Mail -PassThru -Force|
      Add-Member -MemberType NoteProperty -Name "landline_phone_1" -Value $newData.OfficePhone -PassThru -Force|
      Add-Member -MemberType NoteProperty -Name "email_address" -Value $newData.Mail -PassThru -Force|
      Add-Member -MemberType NoteProperty -Name "mobile_phone_1" -Value $newData.MobilePhone -PassThru -Force|
      Add-Member -MemberType NoteProperty -Name "last_name" -Value $newData.SurName -PassThru -Force|
      Add-Member -MemberType NoteProperty -Name "first_name" -Value $newData.GivenName -PassThru -force
  
  } | Export-CSV $ExportedFileCSV
  </code></pre>
  
  <p>If I can avoid exporting the datafile in the first place and just appending the result from the </p>
  
  <pre><code>Get-ADGroupMember -Identity SomeGroup | Get-ADUser -Properties * | Select-Object -Property GivenName, SurName, Mail, MobilePhone, OfficePhone
  </code></pre>
  
  <p>Straight to the csv template, that would work for my needs too, I just wasn't sure how to do that.</p>