mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-15 15:53:32 +00:00
Added try/catch
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
$file = ".\conditionalTextFormatting.xlsx"
|
||||
rm $file -ErrorAction Ignore
|
||||
Remove-Item $file -ErrorAction Ignore
|
||||
|
||||
Get-Service |
|
||||
Select Status, Name, DisplayName, ServiceName |
|
||||
Select-Object Status, Name, DisplayName, ServiceName |
|
||||
Export-Excel $file -Show -AutoSize -AutoFilter -ConditionalText $(
|
||||
New-ConditionalText stop
|
||||
New-ConditionalText runn darkblue cyan
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
$ContainsBlanks = New-ConditionalText -ConditionalType ContainsBlanks
|
||||
|
||||
$data = $(
|
||||
@@ -11,5 +13,5 @@ $data = $(
|
||||
|
||||
$file ="c:\temp\testblanks.xlsx"
|
||||
|
||||
rm $file -ErrorAction Ignore
|
||||
Remove-Item $file -ErrorAction Ignore
|
||||
$data | Export-Excel $file -show -ConditionalText $ContainsBlanks
|
||||
@@ -1,4 +1,6 @@
|
||||
Remove-Item -Path .\test.xlsx -ErrorAction Ignore
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
Remove-Item -Path .\test.xlsx -ErrorAction Ignore
|
||||
|
||||
$excel = Get-Process |
|
||||
Select-Object -Property Name,Company,Handles,CPU,PM,NPM,WS |
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
$f = ".\testExport.xlsx"
|
||||
|
||||
rm $f -ErrorAction Ignore
|
||||
Remove-Item $f -ErrorAction Ignore
|
||||
|
||||
$data = $(
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
rm .\testExport.xlsx -ErrorAction Ignore
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
ps | where Company | select Company, Name, PM, Handles, *mem* |
|
||||
Remove-Item .\testExport.xlsx -ErrorAction Ignore
|
||||
|
||||
Get-Process | Where-Object Company | Select-Object Company, Name, PM, Handles, *mem* |
|
||||
|
||||
Export-Excel .\testExport.xlsx -Show -AutoSize -AutoNameRange `
|
||||
-ConditionalFormat $(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
$f = ".\testExport.xlsx"
|
||||
|
||||
rm $f -ErrorAction Ignore
|
||||
Remove-Item $f -ErrorAction Ignore
|
||||
|
||||
.\GenDates.ps1 |
|
||||
Export-Excel $f -Show -AutoSize -ConditionalText $(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
$f = ".\testExport.xlsx"
|
||||
|
||||
rm $f -ErrorAction Ignore
|
||||
Remove-Item $f -ErrorAction Ignore
|
||||
|
||||
.\GenDates.ps1 |
|
||||
Export-Excel $f -Show -AutoSize -ConditionalText $(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
$f = ".\testExport.xlsx"
|
||||
|
||||
rm $f -ErrorAction Ignore
|
||||
Remove-Item $f -ErrorAction Ignore
|
||||
|
||||
.\GenDates.ps1 |
|
||||
Export-Excel $f -Show -AutoSize -ConditionalText $(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
$f = ".\testExport.xlsx"
|
||||
|
||||
rm $f -ErrorAction Ignore
|
||||
Remove-Item $f -ErrorAction Ignore
|
||||
|
||||
.\GenDates.ps1 |
|
||||
Export-Excel $f -Show -AutoSize -ConditionalText $(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
$f = ".\testExport.xlsx"
|
||||
|
||||
rm $f -ErrorAction Ignore
|
||||
Remove-Item $f -ErrorAction Ignore
|
||||
|
||||
.\GenDates.ps1 |
|
||||
Export-Excel $f -Show -AutoSize -ConditionalText $(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
$f = ".\testExport.xlsx"
|
||||
|
||||
rm $f -ErrorAction Ignore
|
||||
Remove-Item $f -ErrorAction Ignore
|
||||
|
||||
.\GenDates.ps1 |
|
||||
Export-Excel $f -Show -AutoSize -ConditionalText $(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
$f = ".\testExport.xlsx"
|
||||
|
||||
rm $f -ErrorAction Ignore
|
||||
Remove-Item $f -ErrorAction Ignore
|
||||
|
||||
.\GenDates.ps1 |
|
||||
Export-Excel $f -Show -AutoSize -ConditionalText $(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
$f = ".\testExport.xlsx"
|
||||
|
||||
rm $f -ErrorAction Ignore
|
||||
Remove-Item $f -ErrorAction Ignore
|
||||
|
||||
.\GenDates.ps1 |
|
||||
Export-Excel $f -Show -AutoSize -ConditionalText $(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
$f = ".\testExport.xlsx"
|
||||
|
||||
rm $f -ErrorAction Ignore
|
||||
Remove-Item $f -ErrorAction Ignore
|
||||
|
||||
.\GenDates.ps1 |
|
||||
Export-Excel $f -Show -AutoSize -ConditionalText $(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
$f = ".\testExport.xlsx"
|
||||
|
||||
rm $f -ErrorAction Ignore
|
||||
Remove-Item $f -ErrorAction Ignore
|
||||
|
||||
.\GenDates.ps1 |
|
||||
Export-Excel $f -Show -AutoSize -ConditionalText $(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
$f = ".\testExport.xlsx"
|
||||
|
||||
rm $f -ErrorAction Ignore
|
||||
Remove-Item $f -ErrorAction Ignore
|
||||
|
||||
$data = $(
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
ipmo ImportExcel -Force
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
$f = ".\testExport.xlsx"
|
||||
rm $f -ErrorAction Ignore
|
||||
Remove-Item $f -ErrorAction Ignore
|
||||
|
||||
function Get-DateOffset ($days=0) {
|
||||
(Get-Date).AddDays($days).ToShortDateString()
|
||||
|
||||
Reference in New Issue
Block a user