title: Convert DataTable to CSV
body: <p>I want to be able to <code>Import-Csv</code> into a PowerShell table so I can edit each section with PowerShell script, e.g. <code>$table.row[0].name = 100</code>. <code>Import-Csv</code> doesn't give that "table" it makes with CSV file.</p>
  
  <pre><code>$tabName = "TableA"
  $table = New-Object system.Data.DataTable "$tabName"
  $col1 = New-Object system.Data.DataColumn ColumnName1,([string])
  $col2 = New-Object system.Data.DataColumn ColumnName2,([int])
  $table.columns.add($col1)
  $table.columns.add($col2)
  $row = $table.NewRow()
  $row.ColumnName1 = "A"
  $row.ColumnName2 = "1"
  $table.Rows.Add($row)
  $row = $table.NewRow()
  $row.ColumnName1 = "B"
  $row.ColumnName2 = "2" 
  $table.Rows.Add($row)
  $table.PrimaryKey = $table.Columns[0]
  $table | Export-Csv C:\test.csv
  </code></pre>
  
  <p>I want a way to <code>$table | Import-Csv C:\test.csv</code> and have the ability to <code>$table.row[0].columnname1 = "C"</code> and it changes "A" to "C". Then I can re-export it after making changes.</p>