title: Powershell: Read csv and create hashtable, then use data in hashtable to do calculation?
body: <p>I have a CSV file which contains the following table</p>
  
  <pre><code> Name    X      Y     Z
   Al      50    1900   15
   Steel   30    5700   15
  </code></pre>
  
  <p>Basically, the row starts with 'Name' is the header row. I want to firstly read this CSV in powershell and create a hashtable. After that I need to read the data from the hashtable and do a simple calculation. For example, if I use <code>$Hashtable.Al</code>, then I can get the value of <code>X,Y,Z</code>. And the following equation could be <code>$Q = $X+$Y+$Z</code>so that I can get the answer of <code>$Q</code>. (The <code>$Hashtable.Steel</code>should work in the same way.)</p>
  
  <pre><code>    #Read CSV and Create the hashtable
  
      #Read data -X Y Z from hashtable by using
      $Al = $Hashtable.Al
  
      #Do a simple calculation
      $Q = $Al.X + $Al.Y + $Al.Z
      $Q
  </code></pre>