Bonjour,

Je souhaite ajouter deux colonnes se trouvant dans le fichier FinalH au fichier source3
Je le fais en deux fois fois y a t il une solution plus rapide ?

Peut il y avoir un impact si un employee ID n'existe pas dans l'un des deux fichiers ?

Merci pour votre aide :

Code POWERSHELL : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
$FINALH ="C:\TEST\LR-HOURS.csv"
$SOURCE3 ="C:\TEST\SOURCES.csv"
$Result ="C:\TEST\FINAL.csv"
 
$WLC = @{}
Import-Csv -Path $FINALH -Delimiter ";" | ForEach-Object {$WLC.Add($_."Employee Id", $_."Exchange Rate")}
$data = Import-Csv -Path $Source3 -Delimiter ";" | Select-Object *, @{Label="Exchange Rate";Expression={$WLC[$_."Employee Id"]}}
$data | Export-Csv -Path $Result -Delimiter ";" -NoTypeInformation
 
Copy-Item -Path $Result -Destination $Source3
 
$WLC = @{}
Import-Csv -Path $FINALH -Delimiter ";" | ForEach-Object {$WLC.Add($_."Employee Id", $_."Domain")}
$data = Import-Csv -Path $Source3 -Delimiter ";" | Select-Object *, @{Label="Domain";Expression={$WLC[$_."Employee Id"]}}
$data | Export-Csv -Path $Result -Delimiter ";" -NoTypeInformation