I have a CSV file that with contents that needs to be converted to all lowercase
I have tried the code below but it doesn't maintain the CSV structure.
(Get-Content C:\_Scratch\export.csv).ToLower() | Out-File C:\_scratch\export.csv
$Init = Import-Csv C:\_Scratch\export.csv
Is there another option I can try?
Get-Content
is going to give you string array. Add the -Raw
switch to read it in as a single string, and the .toupper()
and .tolower()
string methods should work on that.
(Get-Content C:\_Scratch\export.csv -Raw).ToLower() | Out-File C:\_scratch\export.csv