Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dfinke committed May 7, 2013
1 parent 34473c3 commit 0db1b5f
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Excel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## Node.js + Edge.js + Edge-ps (PowerShell) + Excel

```javascript
var edge = require('edge');

var excelPS = edge.func('ps', function () {/*
$data = $inputFromJS | Invoke-Expression
$xl = New-Object -ComObject Excel.Application
$wf = $xl.WorksheetFunction
New-Object PSObject -Property @{
Median = $wf.Median($data)
StDev = $wf.StDev($data)
Var = $wf.Var($data)
} | ConvertTo-Json
$xlProcess = Get-Process excel
$xlProcess.kill()
*/});

// Invoke PowerShell, it start Excel, gets a WorksheetFunction and then calls
// Median, StDev and Var on the array of data passed in.
// Here we are passing an array of 1 to 100
excelPS('1..100', function(error, result){

if(error) throw error;

console.log(result[0]);
});
```

```
{
"Median": 50.5,
"StDev": 29.011491975882016,
"Var": 841.66666666666663
}
```

0 comments on commit 0db1b5f

Please sign in to comment.