Skip to content

Instantly share code, notes, and snippets.

@jonschoning
Created August 16, 2011 14:38
Show Gist options
  • Save jonschoning/1149233 to your computer and use it in GitHub Desktop.
Save jonschoning/1149233 to your computer and use it in GitHub Desktop.
ExcelMathPowerShell.ps1
# Calling Excel Math Functions From PowerShell
$xl = New-Object -ComObject Excel.Application
$xlprocess = Get-Process excel
$wf = $xl.WorksheetFunction
$data = 1,2,3,4
$m = ((1,2,3),(4,5,6),(7,8,10))
Write-Host -ForegroundColor green Median
$wf.Median($data)
Write-Host -ForegroundColor green StDev
$wf.StDev($data)
Write-Host -ForegroundColor green Var
$wf.Var($data)
Write-Host -ForegroundColor green MInverse
$wf.MInverse($m)
$xl.quit()
$xlprocess | kill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment