Often you may want to use the Export-Csv cmdlet in PowerShell to append data to an existing CSV file.
You can use the following basic syntax to do so:
[PsCustomObject]@{
team = "Kings";
points = "14";
assists = "3";
} | Export-Csv $my_file -append
This particular example will append data with specific values to the end of the CSV file specified at the path in the $my_file variable.
By using the -append operator, we are able to append new data to the end of the file instead of overwriting the existing data.
The following example shows how to use this syntax in practice.
Example: Use Export-Csv to Append Data to Existing File in PowerShell
Suppose we have a CSV file saved in the following location:
- c:\users\bobbi\nba_data.csv
We can use the Get-Content cmdlet to view the contents of this file:

Notice that this CSV file has three columns: team, points, and assists.
Suppose that we would like to add a new row to the end of this CSV file with the following values:
- team: Kings
- points: 14
- assists: 3
We can use the following syntax to do so:
[PsCustomObject]@{
team = "Kings";
points = "14";
assists = "3";
} | Export-Csv $my_file -append
The following screenshot shows how to use this syntax in practice:

When we use the Get-Content cmdlet once again to view the updated file, we can see that a new line has been appended to the end of the file with the exact values that we specified.
Note: You can find the complete documentation for the Export-Csv cmdlet in PowerShell here.
Related Tutorials
The following tutorials explain how to perform other common tasks in PowerShell:
PowerShell: How to Use Export-Csv and Specify Column Order
PowerShell: How to Use export-csv with No Quotes
PowerShell: How to Use Export-Csv with No Headers
