title: Read multiple values from a column in a csv file and pass to a function
body: <p>I have a file named <code>group.csv</code> which contains data like the below:</p>
  
  <pre><code>Name  group                      location
  A     group1                      local
  B     group1,group2               local2
  c     group1,group2,group3        local3
  </code></pre>
  
  <p>I am not able to read <code>group1</code>, <code>group2</code> or <code>group3</code> independently and I am therefore unable to pass the values correctly in to a function.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>$fpath = Import-Csv C:\klc\group.csv
  foreach($abc in $fpath){
  $Name = $abc.Name
  $group = $abc.group
  $location = $abc.location
  
   function display ($Name,$group,$location)
   {
  
    $group01 = $group
  
     for($i=0;$i -lt $group01.count;$i++)
      {
     try{
   Add-group -Name $Name -Group $group01[i] -Location Location -ErrorAction 
  stop
    }catch [Expression]
    {
     Write-Host "Unable to Add"
    }
    Write-Host "successfully Added"
    }
    }
  </code></pre>