title: How to import csv to az storage table
body: <p>Am trying to upload csv file to the azure table storage, which has 1000 + records and 6 columns, as shown below as Csvheadres, unfortunately, ended up with an error.do I need to add partition key and row key columns?</p>
  <p>the CSV columns(CsvHeaders)
  res1
  res2
  res3
  res4
  res5
  res6</p>
  <pre><code>$storageAccountKey = (Get-AzStorageAccountKey -ResourceGroupName $resourceGroupName -Name $storageAccountName).Value[0]
      $ctx = New-AzStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey
      $table = Get-AzStorageTable -Name $tableName -Context $ctx 
      
      $CsvContents = Import-Csv -Path $Path
      $CsvHeaders = ($CsvContents[0] | Get-Member -MemberType NoteProperty).Name | Where{$_ -ne &quot;RowKey&quot; -and $_ -ne &quot;PartitionKey&quot;}
      
      Foreach($CsvContent in $CsvContents)
      {
          $PartitionKey = $CsvContent.PartitionKey
          $RowKey = $CsvContent.RowKey
          $Entity = New-Object &quot;Microsoft.Azure.Cosmos.Table.DynamicTableEntity&quot; &quot;$PartitionKey&quot;, &quot;$RowKey&quot;
      
          Foreach($CsvHeader in $CsvHeaders)
          {
              $Value = $CsvContent.$CsvHeader
              $Entity.Properties.Add($CsvHeader, $Value)
          }
          Write-Verbose &quot;Inserting the entity into table storage.&quot;
          $result = $Table.Execute([Microsoft.Azure.Cosmos.Table.TableOperation]::Insert($Entity))
      }
      
       
  </code></pre>