mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Expand a few aliases
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
echo Last7Days LastMonth LastWeek NextMonth NextWeek ThisMonth ThisWeek Today Tomorrow Yesterday |
|
echo Last7Days LastMonth LastWeek NextMonth NextWeek ThisMonth ThisWeek Today Tomorrow Yesterday |
|
||||||
% {
|
Foreach-Object {
|
||||||
$text = @"
|
$text = @"
|
||||||
`$f = ".\testExport.xlsx"
|
`$f = ".\testExport.xlsx"
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
$sign=@{sign=echo + -}
|
$sign=@{sign=echo + -}
|
||||||
$location=@{location=echo Atlanta Newark Washington Chicago Philadelphia Houston Phoneix}
|
$location=@{location=echo Atlanta Newark Washington Chicago Philadelphia Houston Phoneix}
|
||||||
|
|
||||||
$(1..6 | % {
|
$(1..6 | Foreach-Object {
|
||||||
|
|
||||||
$from=$to=""
|
$from=$to=""
|
||||||
while($from -eq $to) {
|
while($from -eq $to) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||||
|
|
||||||
$plt = New-Plot
|
$plt = New-Plot
|
||||||
$plt.Plot((Get-Range 0 5 .02|%{[math]::Cos(2*[math]::pi*$_)}))
|
$plt.Plot((Get-Range 0 5 .02|Foreach-Object {[math]::Cos(2*[math]::pi*$_)}))
|
||||||
$plt.SetChartSize(800,300)
|
$plt.SetChartSize(800,300)
|
||||||
$plt.Show()
|
$plt.Show()
|
||||||
@@ -2,6 +2,6 @@ try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
|||||||
|
|
||||||
. $PSScriptRoot\TestAPIReadXls.ps1
|
. $PSScriptRoot\TestAPIReadXls.ps1
|
||||||
|
|
||||||
Test-APIReadXls $PSScriptRoot\testlist.xlsx | % {
|
Test-APIReadXls $PSScriptRoot\testlist.xlsx | Foreach-Object {
|
||||||
Invoke-Pester -Script $_.fullname -PassThru -Show None
|
Invoke-Pester -Script $_.fullname -PassThru -Show None
|
||||||
}
|
}
|
||||||
@@ -269,7 +269,7 @@
|
|||||||
Verbose = $true
|
Verbose = $true
|
||||||
}
|
}
|
||||||
Remove-Item -Path $ExcelParams.Path -Force -EA Ignore
|
Remove-Item -Path $ExcelParams.Path -Force -EA Ignore
|
||||||
Get-Service | Select Name, Status, DisplayName, ServiceName |
|
Get-Service | Select-Object -Property Name, Status, DisplayName, ServiceName |
|
||||||
Export-Excel @ExcelParams -ConditionalText $(
|
Export-Excel @ExcelParams -ConditionalText $(
|
||||||
New-ConditionalText Stop DarkRed LightPink
|
New-ConditionalText Stop DarkRed LightPink
|
||||||
New-ConditionalText Running Blue Cyan
|
New-ConditionalText Running Blue Cyan
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ function Get-HtmlTable {
|
|||||||
|
|
||||||
if(!$propertyNames) {
|
if(!$propertyNames) {
|
||||||
if($cells[0].tagName -eq 'th') {
|
if($cells[0].tagName -eq 'th') {
|
||||||
$propertyNames = @($cells | foreach {$_.innertext -replace ' ',''})
|
$propertyNames = @($cells | ForEach-Object {$_.innertext -replace ' ',''})
|
||||||
} else {
|
} else {
|
||||||
$propertyNames = @(1..($cells.Count + 2) | % { "P$_" })
|
$propertyNames = @(1..($cells.Count + 2) | Foreach-Object { "P$_" })
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
function Get-XYRange {
|
function Get-XYRange {
|
||||||
param($targetData)
|
param($targetData)
|
||||||
|
|
||||||
$record = $targetData| select -First 1
|
$record = $targetData | Select-Object -First 1
|
||||||
$p=$record.psobject.Properties.name
|
$p=$record.psobject.Properties.name
|
||||||
|
|
||||||
$infer = for ($idx = 0; $idx -lt $p.Count; $idx++) {
|
$infer = for ($idx = 0; $idx -lt $p.Count; $idx++) {
|
||||||
@@ -20,7 +20,7 @@ function Get-XYRange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[PSCustomObject]@{
|
[PSCustomObject]@{
|
||||||
XRange = $infer | ? {$_.datatype -match 'string'} | select -First 1 excelcolumn, name
|
XRange = $infer | Where-Object -FilterScript {$_.datatype -match 'string'} | Select-Object -First 1 -Property excelcolumn, name
|
||||||
YRange = $infer | ? {$_.datatype -match 'int|double'} |select -First 1 excelcolumn, name
|
YRange = $infer | Where-Object -FilterScript {$_.datatype -match 'int|double'} | Select-Object -First 1 -Property excelcolumn, name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ function ConvertFrom-ExcelColumnName {
|
|||||||
|
|
||||||
$sum=0
|
$sum=0
|
||||||
$columnName.ToCharArray() |
|
$columnName.ToCharArray() |
|
||||||
ForEach {
|
ForEach-Object {
|
||||||
$sum*=26
|
$sum*=26
|
||||||
$sum+=[char]$_.tostring().toupper()-[char]'A'+1
|
$sum+=[char]$_.tostring().toupper()-[char]'A'+1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ function Invoke-AllTests {
|
|||||||
)
|
)
|
||||||
|
|
||||||
$resultCount=0
|
$resultCount=0
|
||||||
$tests.GetEnumerator() | ForEach {
|
$tests.GetEnumerator() | ForEach-Object {
|
||||||
|
|
||||||
$result=& $_.Value $target
|
$result=& $_.Value $target
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
>
|
>
|
||||||
PS> Get-WmiObject -Class win32_logicaldisk | select -Property DeviceId,VolumeName, Size,Freespace |
|
PS> Get-WmiObject -Class win32_logicaldisk | Select-Object -Property DeviceId,VolumeName, Size,Freespace |
|
||||||
Export-Excel -Path "$env:computerName.xlsx" -WorkSheetname Volumes -NumberFormat "0,000"
|
Export-Excel -Path "$env:computerName.xlsx" -WorkSheetname Volumes -NumberFormat "0,000"
|
||||||
PS> Get-NetAdapter | Select-Object Name,InterfaceDescription,MacAddress,LinkSpeed |
|
PS> Get-NetAdapter | Select-Object Name,InterfaceDescription,MacAddress,LinkSpeed |
|
||||||
Export-Excel -Path "$env:COMPUTERNAME.xlsx" -WorkSheetname NetAdapter
|
Export-Excel -Path "$env:COMPUTERNAME.xlsx" -WorkSheetname NetAdapter
|
||||||
|
|||||||
@@ -29,6 +29,6 @@
|
|||||||
Import-Module .\ImportExcel.psd1 -Force
|
Import-Module .\ImportExcel.psd1 -Force
|
||||||
|
|
||||||
$names = Get-ExcelSheetInfo C:\Temp\testDelete.xlsx
|
$names = Get-ExcelSheetInfo C:\Temp\testDelete.xlsx
|
||||||
$names | % { Remove-WorkSheet C:\Temp\testDelete.xlsx $_.Name}
|
$names | Foreach-Object { Remove-WorkSheet C:\Temp\testDelete.xlsx $_.Name}
|
||||||
|
|
||||||
##Remove-WorkSheet C:\Temp\testDelete.xlsx sheet6
|
##Remove-WorkSheet C:\Temp\testDelete.xlsx sheet6
|
||||||
@@ -18,7 +18,7 @@ Describe "Creating small named ranges with hyperlinks" {
|
|||||||
$worksheet = $excel.Workbook.Worksheets[1]
|
$worksheet = $excel.Workbook.Worksheets[1]
|
||||||
$columns = $worksheet.Dimension.Columns
|
$columns = $worksheet.Dimension.Columns
|
||||||
|
|
||||||
1..$columns | foreach {Add-ExcelName -Range $worksheet.cells[$topRow,$_,$lastDataRow,$_]} #Test Add-Excel Name on its own (outside Export-Excel)
|
1..$columns | ForEach-Object {Add-ExcelName -Range $worksheet.cells[$topRow,$_,$lastDataRow,$_]} #Test Add-Excel Name on its own (outside Export-Excel)
|
||||||
|
|
||||||
$scwarnVar = $null
|
$scwarnVar = $null
|
||||||
Set-ExcelColumn -Worksheet $worksheet -StartRow $topRow -Heading "PlacesGained/Lost" `
|
Set-ExcelColumn -Worksheet $worksheet -StartRow $topRow -Heading "PlacesGained/Lost" `
|
||||||
@@ -39,7 +39,7 @@ Describe "Creating small named ranges with hyperlinks" {
|
|||||||
$ct = New-ConditionalText -Text "Ferrari"
|
$ct = New-ConditionalText -Text "Ferrari"
|
||||||
$ct2 = New-ConditionalText -Range $worksheet.Names["FinishPosition"].Address -ConditionalType LessThanOrEqual -Text 3 -ConditionalText Red -Background White #Test new-conditionalText in shortest and longest forms.
|
$ct2 = New-ConditionalText -Range $worksheet.Names["FinishPosition"].Address -ConditionalType LessThanOrEqual -Text 3 -ConditionalText Red -Background White #Test new-conditionalText in shortest and longest forms.
|
||||||
#Create links for each group name (race) and Export them so they start at Cell A1; create a pivot table with definition just created, save the file and open in Excel
|
#Create links for each group name (race) and Export them so they start at Cell A1; create a pivot table with definition just created, save the file and open in Excel
|
||||||
$results | foreach {(New-Object -TypeName OfficeOpenXml.ExcelHyperLink -ArgumentList "Sheet1!$($_.Name)" , "$($_.name) GP")} | #Test Exporting Hyperlinks with display property.
|
$results | ForEach-Object {(New-Object -TypeName OfficeOpenXml.ExcelHyperLink -ArgumentList "Sheet1!$($_.Name)" , "$($_.name) GP")} | #Test Exporting Hyperlinks with display property.
|
||||||
Export-Excel -ExcelPackage $excel -AutoSize -PivotTableDefinition $pt -Calculate -ConditionalFormat $ct,$ct2 #Test conditional text rules in conditional format (orignally icon sets only )
|
Export-Excel -ExcelPackage $excel -AutoSize -PivotTableDefinition $pt -Calculate -ConditionalFormat $ct,$ct2 #Test conditional text rules in conditional format (orignally icon sets only )
|
||||||
|
|
||||||
$excel = Open-ExcelPackage $path
|
$excel = Open-ExcelPackage $path
|
||||||
|
|||||||
2
plot.ps1
2
plot.ps1
@@ -155,7 +155,7 @@ class PSPlot {
|
|||||||
$sum=0
|
$sum=0
|
||||||
|
|
||||||
$columnName.ToCharArray() |
|
$columnName.ToCharArray() |
|
||||||
ForEach {
|
ForEach-Object {
|
||||||
$sum*=26
|
$sum*=26
|
||||||
$sum+=[char]$_.tostring().toupper()-[char]'A'+1
|
$sum+=[char]$_.tostring().toupper()-[char]'A'+1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ function ConvertFrom-ExcelColumnName {
|
|||||||
|
|
||||||
$sum=0
|
$sum=0
|
||||||
$columnName.ToCharArray() |
|
$columnName.ToCharArray() |
|
||||||
ForEach {
|
ForEach-Object {
|
||||||
$sum*=26
|
$sum*=26
|
||||||
$sum+=[char]$_.tostring().toupper()-[char]'A'+1
|
$sum+=[char]$_.tostring().toupper()-[char]'A'+1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user