O'Reilly logo

Microsoft® SQL Server 2012 Unleashed by Alex T. Silverstein, Chris Gallelli, Paul T. Bertucci, Ray Rankins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required