I want to do the following:
$content = $source | ConvertFrom-Csv -Header $HEADER
My problem is the Variable $HEADER. I use Get-Content to get the desired content. Unfortunately this adds quotes around the object, therefore -Header treats the list of columns as one column and ignores the commas.
If I echo $HEADER I get the following:
"a","b","c"
But it is treated as:
'"a","b","c"'
If I override $HEADER like this everything works:
$HEADER = "a","b","c"
Unfortunately I need to use Get-Content because my Header needs to be variable.
I believe -remove "'", ""
only deletes characters in the string and not the surrounding quotes.
Any help is much appreciated :)