Sending Results to Excel

by Dec 20, 2012

Here's a little function called Out-ExcelReport. Just pipe anything to it, and it will open in Microsoft Excel – provided it is installed on your system:

function Out-ExcelReport
{
  param
  (
    $Path = "$env:temp\$(Get-Random).csv"
  )

  $Input | Export-Csv -Path $Path -Encoding UTF8 -NoTypeInformation -UseCulture
  Invoke-Item -Path $Path
}
Get-Process | Out-ExcelReport

Twitter This Tip! ReTweet this Tip!