Pipe Information to Excel

by Oct 16, 2017

Here is a small yet very useful function that receives data from other cmdlets and sends them to Excel:

function Out-Excel 
{

  param(
    $path = "$env:temp\report$(Get-Date -Format yyyyMMddHHmmss).csv"
  )
  
  $Input | 
    Export-Csv $path -NoTypeInformation -UseCulture -Encoding UTF8
    Invoke-Item $path 
}

Simply pipe anything you want to Out-Excel. For example:

 
PS C:\> Get-Process | Out-Excel
 

Twitter This Tip! ReTweet this Tip!