I have a starting csv with sample data like so:
Underlying AllBlue AllRed
---------- ------- ------
AUD 1/5/2024
BRR
GBP 3/10/2024
CAD
Today, 4/29/2024, via another process, a new CSV is produced, like this for example
Underlying AllBlue AllRed
---------- ------- ------
AUD
BRR 4/29/2024
GBP 4/29/2024
CAD 4/29/2024
and I’m looking to append any new data found in columns ‘AllBlue’ and ‘AllRed’ only, to the original csv.
Desired outcome would be
Underlying AllBlue AllRed
---------- ------- ------
AUD 1/5/2024
BRR 4/29/2024
GBP 4/29/2024
CAD 4/29/2024
Notice how the new data from 4/29/2024 csv is overwriting to original. Also, how the GBP/AllBlue cell is updated with the new date.
#sandbox testing
$CSVFiles = Get-ChildItem -Path "C:Sandboxtest" -Filter "*.csv"
#put into array
$CSVData = @()
ForEach ($CSVFile in $CSVFiles) {
$CSVContent = Import-Csv -Path $CSVFile.FullName
$CSVData += $CSVContent
}
#output
$CSVData | Export-Csv -Path "C:Sandboxtestoutputcolors.csv" -NoTypeInformation -Append
This appends the data, but doesn’t overwrite the columns?. Ive tried multiple parameters clobber, append.
Thank you for your time.
1