title: append data to an existing csv file with data
body: <p>Below is the data i already have in my csv</p>
  <pre><code>ServerName  Start Time  End Time
  localhost   1599222660  1599222660
  
  </code></pre>
  <p>now i have below data which needs to be added in this existing data</p>
  <pre><code>pl_AVERAGE  pl_MAX  pl_MIN  rta_AVERAGE rta_MAX     rta_MIN
  0           0       0       0.044726667 0.044726667 0.044726667
  </code></pre>
  <p>i tried like below but getting error</p>
  <pre><code>Export-Csv &quot;C:\Script\sum.csv&quot; -NoType -Append
  </code></pre>
  <pre><code>Export-Csv : Cannot append CSV content to the following file: C:\Script\sum.csv. The appended object does not have a property that corresponds to the following column: 
  ServerName. To continue with mismatched properties, add the -Force parameter, and then retry the command.
  At C:\script\Capacity_Data.ps1:528 char:41
  + ... pscustomobject]$Hash | Export-Csv &quot;C:\Script\sum.csv&quot; -NoType -Append
  +                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidData: (ServerName:String) [Export-Csv], InvalidOperationException
      + FullyQualifiedErrorId : CannotAppendCsvWithMismatchedPropertyNames,Microsoft.PowerShell.Commands.ExportCsvCommand
  </code></pre>
  <p>i tried adding <strong>-force</strong>, but then it was not writing anything to the csv</p>
  <p>below is the code</p>
  <pre><code>
  $csvContents = @()
              $row = New-Object System.Object 
              $row | Add-Member -MemberType NoteProperty -Name &quot;ServerName&quot; -Value $Server
              $row | Add-Member -MemberType NoteProperty -Name &quot;Start Time&quot; -Value $FirstTimeStamp
              $row | Add-Member -MemberType NoteProperty -Name &quot;End Time&quot; -Value $FirstTimeStamp
              $csvContents += $row
  #writing first 3 columns
              $csvContents | Export-CSV -Path &quot;C:\Script\sum.csv&quot; -NoTypeInformation -Append
      
              $New_Extracted_Data | Export-Csv &quot;C:\Script\Final.csv&quot; -NoType
              $New_Extracted_Data | Select-Object -Property * -ExcludeProperty timestamp |
              Export-Csv &quot;C:\Script\Final.csv&quot; -NoType
              $Properties = ($New_Extracted_Data[0] | Get-Member -MemberType NoteProperty |
              Where Name -ne 'timestamp').Name
              $Hash = [ordered]@{}
                  foreach ($Property in $Properties) {
                      $Hash[$Property] = (($New_Extracted_Data.$Property | Measure -Sum).Sum)/$NumberOfRowsToPick
  
                  }
  #2nd time writing 
                  [pscustomobject]$Hash | Export-Csv &quot;C:\Script\sum.csv&quot; -NoType -Append
  
  </code></pre>