I have two csv files. Let's say I have three columns in the first file that are Name, ID, and Phone, and the second file is Address and Location. I am trying to merge them using the following script:
$dir = ".\csvs"
foreach ($csv in (Get-ChildItem "$dir\*.csv"))
{
Import-Csv $csv | Export-Csv .\merged.csv -NoTypeInformation -Append
}
But am receving the following error:
Export-Csv : Cannot append CSV content to the following file: .\merged.csv. The appended object does not have a
property that corresponds to the following column: . To continue with mismatched properties, add the -Force parameter,
and then retry the command.
What is this error trying to say? The new file is empty.