Complete the code to import a CSV file named 'data.csv' into a variable.
$data = [1] -Path 'data.csv'
The Import-Csv cmdlet reads a CSV file and converts it into objects in PowerShell.
Complete the code to export the variable $data to a CSV file named 'output.csv' without type information.
$data | [1] -Path 'output.csv' -NoTypeInformation
The Export-Csv cmdlet converts objects into CSV format and saves them to a file.
Fix the error in the code to import 'records.csv' and select only the 'Name' column.
$names = [1] -Path 'records.csv' | Select-Object Name
To read CSV data as objects, use Import-Csv. Then you can select columns.
Fill both blanks to filter imported CSV data where Age is greater than 30.
$filtered = [1] -Path 'people.csv' | Where-Object { $_.Age [2] 30 }
Use Import-Csv to read the file, then filter with Where-Object using the 'greater than' operator.
Fill all three blanks to create a CSV from $users with only 'Username' and 'Email' where 'Active' is true.
$activeUsers = { [1]: [2], Email: $_.Email for [3] in $users if $_.Active } | Export-Csv -Path 'active.csv' -NoTypeInformationThis creates a custom object with Username and Email for each active user, then exports to CSV.