Import-Csv from string instead from a file? Import-Csv from string instead from a file? powershell powershell

Import-Csv from string instead from a file?


You can use ConvertFrom-Csv instead:

$csv_content = $some_string | ConvertFrom-Csv -Delim ';'

Import-Csv is little more than a wrapper around Get-Content and ConvertFrom-Csv.


Even better:

$csv_content1 = ConvertFrom-CSV -delim ';' -Input @""col1"; "col2"val11 ; val12val21 ; val22"@