Convert CSV to Excel using PowerShell

There are many posts explaining how to convert CSV to Excel using PowerShell, but most of them requires Microsoft Office to be installed on the machine. I try to find most simple solution and it is by using of combination Import-Csv and Export-Excel from PowerShell module ImportExcel.

Sample CSV file is created by exporting top 10 services:

Get-Service | Select-Object Name,Status,StartType -First 10 | Export-Csv Services.csv -NoTypeInformation

Content of created CSV file:

"Name","Status","StartType"
"AarSvc_a3189","Stopped","Manual"
"AdobeARMservice","Running","Automatic"
"AESMService","Running","Automatic"
"AJRouter","Stopped","Manual"
"ALG","Stopped","Manual"
"AMD External Events Utility","Running","Automatic"
"AppHostSvc","Running","Automatic"
"AppIDSvc","Stopped","Manual"
"Appinfo","Running","Manual"
"AppMgmt","Stopped","Manual"


Udemy course: Improve your productivity with PowerShell

Next step is to install PowerShell module ImportExcel:

Install-Module ImportExcel

After this step in everything prepared for the conversion. Conversion from CSV to Excel is very easy:

Import-Csv Services.csv | Export-Excel Services.xlsx

Converted file opened in Excel:

Converted file opened in Excel

If you are interested in PowerShell automation, take my Udemy course Improve your productivity with PowerShell.

Leave a Reply

Your email address will not be published. Required fields are marked *