Dealing with CSV Files

PowerShell provides two cmdlets that help greatly when you are dealing with files in the comma-separated value (CSV) format:

Image Import-Csv—This cmdlet reads in a CSV file and creates objects from its contents.

Image Export-Csv—This cmdlet takes an object (or objects) as input and creates a CSV file, as shown here:

Click here to view code image

PS>dir | Export-Csv c:\temp\file.csv

This simple example shows how to output the contents of the current directory to a CSV-formatted file. Looking at the contents of this file displays information ...

Get Microsoft® SQL Server 2012 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.