Powershell Transpose Table

Job ID: 35227173

Budget: $10 – $30 CAD

I have a table in Powershell that needs to be transposed. The date field is dynamic (depending on the day of the week) Current table layout is below: The date field will change between 7 dates in the week (ie, 10-Apr-2022, 11-Apr-2022, ... , 16-Apr-2022)

PS C:\Users\Geoff> $croptrackerImport[1]


Date : 12-Apr-2022
Employee : Bob Smith, CC47963
Piecework Hours : 0.00
Piecework Hours Payout : 0.00
Piecework Pieces Payout : 0.00
Final Piecework Payout : 0.00
Regular Hours : 8.32
Regular Hours Payout : 124.75
Final Payout : 124.75

Need it into the following table:
'Worker Name'= $croptrackerImport[$i].'Employee'.split(',')[1])
'Employee # = $croptrackerImport[$i].'Employee'.split(',')[1].trim().replace(' ','')
'10-Apr-22' = $croptrackerImport[$i].'Regular Hours' IF $croptrackerImport[$i].date = '10-Apr-22' ELSE 0
'11-Apr-22' = $croptrackerImport[$i].'Regular Hours' IF $croptrackerImport[$i].date = '11-Apr-22' ELSE 0
'12-Apr-22' = $croptrackerImport[$i].'Regular Hours' IF $croptrackerImport[$i].date = '12-Apr-22' ELSE 0
...
'16-Apr-22' = $croptrackerImport[$i].'Regular Hours' IF $croptrackerImport[$i].date = '16-Apr-22' ELSE 0
Related categories: Powershell Coding