mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Initial commit
This commit is contained in:
23
Examples/New-PSItem.ps1
Normal file
23
Examples/New-PSItem.ps1
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
function New-PSItem {
|
||||||
|
|
||||||
|
$totalArgs = $args.Count
|
||||||
|
|
||||||
|
if($args[-1] -is [array]) {
|
||||||
|
$script:PSItemHeader=$args[-1]
|
||||||
|
$totalArgs-=1
|
||||||
|
}
|
||||||
|
|
||||||
|
$h=[ordered]@{}
|
||||||
|
|
||||||
|
for ($idx = 0; $idx -lt $totalArgs; $idx+=1) {
|
||||||
|
if($PSItemHeader) {
|
||||||
|
$key = $PSItemHeader[$idx]
|
||||||
|
} else {
|
||||||
|
$key = "P$($idx+1)"
|
||||||
|
}
|
||||||
|
|
||||||
|
$h.$key=$args[$idx]
|
||||||
|
}
|
||||||
|
|
||||||
|
[PSCustomObject]$h
|
||||||
|
}
|
||||||
12
Examples/SpreadsheetCells/ExcelFunctions.ps1
Normal file
12
Examples/SpreadsheetCells/ExcelFunctions.ps1
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
. ..\New-PSItem.ps1
|
||||||
|
|
||||||
|
rm *.xlsx
|
||||||
|
|
||||||
|
$(
|
||||||
|
New-PSItem =2%/12 60 500000 "=pmt(rate,nper,pv)" (echo rate nper pv pmt)
|
||||||
|
New-PSItem =3%/12 60 500000 "=pmt(rate,nper,pv)"
|
||||||
|
New-PSItem =4%/12 60 500000 "=pmt(rate,nper,pv)"
|
||||||
|
New-PSItem =5%/12 60 500000 "=pmt(rate,nper,pv)"
|
||||||
|
New-PSItem =6%/12 60 500000 "=pmt(rate,nper,pv)"
|
||||||
|
New-PSItem =7%/12 60 500000 "=pmt(rate,nper,pv)"
|
||||||
|
) | Export-Excel functions.xlsx -AutoNameRange -AutoSize -Show
|
||||||
Reference in New Issue
Block a user