Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

CSV parsing values

$
0
0

hello! I need some help, I need to take each row from a csv sheet, that looks like this: 

header is asownerse

ID@domain.com; ID2@domain.com; ID3@domain.com

And put each of the email addresses into their own cell. The code I've been using works but I'm seeing that it cuts off the 2nd email address, 3rd, so on so forth. Some cells only have 1 email address, some have up to 5. 

$CsvFile = Import-Csv -Path C:\users\ID\desktop\Email.csv

$CsvFile = $CsvFile | ForEach-Object {

    $_.asownerse = ($_.asownerse -split ';')[0]

    $_

}

$Csvfile | Export-Csv -Path C:\users\ID\desktop\test.csv -NoTypeInformation 

Thanks!


Viewing all articles
Browse latest Browse all 6937

Trending Articles