I need to delete the first two columns in a CSV. I do not know the header names, they are not static. I figured out how to remove the first two rows, but not the first two columns. The sample code I am working with is below
$csv = Import-Csv 'input.csv'
$headers = $csv[0].PSObject.Properties | select -Expand Name
$step = 4
for ($i = 0; $i -lt $headers.Count; $i += $step) {
$csv | select $headers[$i..($i+$step-1)] |
Export-Csv "output_$($i/$step).csv" -NoType
}
$headers[$i..($i+$step-1)]