Posts

Showing posts from February, 2021

How to Import and Export Delimited Files, like CSV, in PowerShell

Image
In this tutorial, we will see how we can use PowerShell to import and export CSV file's data. Managing CSV Files using Import/Export-CSV in PowerShell We have two important cmdlets import-csv/export-csv which are widely used while working with CSV. Before moving to how to manage these type of files, First look at what is CSV file: A Comma Separated Values ( CSV ) file is a plain text file that contains a list of data. These files are often used for exchanging data between different applications. For example, databases and contact managers often support CSV files. A CSV file has a fairly simple structure. It’s a list of data separated by commas as you can see in below screenshot. We have file "email.csv" having email address and name separated by comma. You can use notepad/excel to open thses file. Now lets move back to our main topic, how to manage csv files with PowerShell.  Reading CSV Files with Import-Csv Importing of csv file is pretty straight forward. First move to