How do I script a CSV Column Header with Special Characters in Powershell?

时间:2016-02-12 20:49:51

标签: csv powershell

I was building a powershell script to parse a CSV file. However, I found one of my column headers is written on Two Lines with a carriage return and new lines.

My column header is: Invoice [New line carriage return] Data

$spreadsheet.Invoice Data

When I try accessing this column through the console, the script passes a carriage return & new line in directly to the input, but I can't include this in a Powershell Shell script. Is there anyway to access this column through a script.

1 个答案:

答案 0 :(得分:0)

I think I found it. Instead of using Special Characters, if I actually put in an "Enter" Key in between strings, I can build the special characters I need. So my script becomes:

$row.Date = $spreadsheetRow."Invoice
Data"