Jun 28 2022 04:14 AM
Hello, I would like to read the contents line by line of a CSV fishie using PowerShell but I can't.
I tried this code but it doesn't show me the $Identifiant and $Nom values in ISE PowerShell console. :
$CSV = Import-CSV -Path "C:\Scripts\1234.csv" -Delimiter ";"
Foreach($Ligne in $CSV){
$Identifiant = $($Ligne."Identifiant technique du document")
$Nom = $($Ligne."Nom de fichier")
Write-host "Identifiant technique :" $Identifiant "Nom du fichier :" $Nom
}
I have this in output :
And my CSV file is like this :
Identifiant technique du document | Nom de fichier |
1111111111111111111 | 1.json |
2222222222222222222 | 2.json |
3333333333333333333 | 3.json |
4444444444444444444 | 4.json |
5555555555555555555 | 5.json |
6666666666666666666 | 6.json |
7777777777777777777 | 7.json |
Can you help me please ? :( Thanks in advance !
Jun 28 2022 04:36 AM - edited Jun 28 2022 04:41 AM
SolutionCould you try this?
$Identifiant = "$($Ligne).'Identifiant technique du document'"
$Nom = "$($Ligne.)"N'om de fichier'"
Write-Host "Identifiant technique : $(Identifiant) Nom du fichier : $($Nom)"