Remove 72 empty catch blocks and Loadpsd1

This commit is contained in:
jhoneill
2019-11-18 07:50:20 +00:00
parent d3a2edcc5f
commit f27729d2ab
73 changed files with 73 additions and 76 deletions

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$xlSourcefile = "$env:TEMP\Source.xlsx"
write-host "Save location: $xlSourcefile"
@@ -6,7 +6,7 @@ write-host "Save location: $xlSourcefile"
Remove-Item $xlSourcefile -ErrorAction Ignore
#Put some simple data in a worksheet and Get an excel package object to represent the file
$TabData1 = 1..5 | Export-Excel $xlSourcefile -WorksheetName 'Tab 1' -AutoSize -AutoFilter
$TabData1 = 1..5 | Export-Excel $xlSourcefile -WorksheetName 'Tab1' -AutoSize -AutoFilter
#Add another tab. Replace the $TabData2 with your data
$TabData2 = 1..10 | Export-Excel $xlSourcefile -WorksheetName 'Tab 2' -AutoSize -AutoFilter

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$xlSourcefile = "$env:TEMP\Source.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
Remove-Item temp.xlsx -ErrorAction Ignore

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
Remove-Item temp.xlsx -ErrorAction Ignore

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
Remove-Item -Path Tools.xlsx

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
function plot {
param(

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$file = "$env:temp\conditionalTextFormatting.xlsx"
Remove-Item $file -ErrorAction Ignore

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
#Define a "Contains blanks" rule. No format is specified so it default to dark-red text on light-pink background.
$ContainsBlanks = New-ConditionalText -ConditionalType ContainsBlanks

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$path = "$env:temp\test.xlsx"
Remove-Item -Path $path -ErrorAction Ignore

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$f = "$env:TEMP\testExport.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
Remove-Item "$env:TEMP\testExport.xlsx" -ErrorAction Ignore

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$f = ".\testExport.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$f = ".\testExport.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$f = ".\testExport.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$f = ".\testExport.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$f = ".\testExport.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$f = ".\testExport.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$f = ".\testExport.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$f = ".\testExport.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$f = ".\testExport.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$f = ".\testExport.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$f = ".\testExport.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
Remove-Item -Path .\test.xlsx -ErrorAction Ignore

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$f = ".\testExport.xlsx"
Remove-Item $f -ErrorAction Ignore

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
Remove-Item -Path .\test.xlsx -ErrorAction Ignore

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
ConvertFrom-ExcelToSQLInsert People .\testSQLGen.xlsx

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$f = "$env:temp\dashboard.xlsx"
Remove-Item $f -ErrorAction Ignore

View File

@@ -13,7 +13,7 @@
* Add .01 in column F
#>
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$path = "$Env:TEMP\DataValidation.xlsx"
Remove-Item $path -ErrorAction SilentlyContinue

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
ConvertFrom-ExcelToSQLInsert -TableName "Movies" -Path ".\Movies.xlsx" -ConvertEmptyStringsToNull
''

View File

@@ -1,6 +1,6 @@
param ($fibonacciDigits=10)
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$file = "fib.xlsx"
Remove-Item "fib.xlsx" -ErrorAction Ignore

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$xlfile = "$env:temp\testFmt.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$xlfile = "$env:temp\testFmt.xlsx"
Remove-Item $xlfile -ErrorAction Ignore

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
@"
site,link

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
Import-Html "http://en.wikipedia.org/wiki/Demographics_of_India" 4

View File

@@ -1,3 +1,3 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
Import-Html "http://www.science.co.il/PTelements.asp" 1

View File

@@ -1,3 +1,3 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
Import-Html "https://en.wikipedia.org/wiki/List_of_Star_Trek:_The_Original_Series_episodes" 2

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$xlfile = "$env:temp\AllSales.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
ColumnChart -Title "Central Limit Theorem" -NoLegend ($(
for ($i = 1; $i -le 500; $i++) {

View File

@@ -2,7 +2,7 @@
# Sum up handles by company
# Show the Pie Chart
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
PieChart -Title "Total Handles by Company" `
(Invoke-Sum (Get-Process | Where-Object company) company handles)

View File

@@ -2,7 +2,7 @@
# Sum up PM by company
# Show the Pie Chart
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
PieChart -Title "Total PM by Company" `
(Invoke-Sum (Get-Process|Where-Object company) company pm)

View File

@@ -1,3 +1,3 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
BarChart (.\TargetData.ps1) "A BarChart"

View File

@@ -1,3 +1,3 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
ColumnChart (.\TargetData.ps1) "A ColumnChart"

View File

@@ -1,3 +1,3 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
PieChart (.\TargetData.ps1) "A PieChart"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$xlFile = "$env:TEMP\mw.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$xlfile = "$env:TEMP\testThis.xlsx"
Remove-Item $xlfile -ErrorAction Ignore

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$header = echo `
'Date/Time - Peak Brightness (UT)' `

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$file = "$env:TEMP\disks.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$file = "$env:temp\disks.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$file = "disks.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$file = "disks.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$file = "disks.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$file = "disks.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$file = "$env:Temp\sales.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$ExcelParams = @{
Path = "$env:TEMP\test1.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$xlFile="$env:TEMP\testPivot.xlsx"
Remove-Item $xlFile -ErrorAction Ignore

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$plt = New-Plot
$plt.Plot((Get-Range 0 5 .02|Foreach-Object {[math]::Cos(2*[math]::pi*$_)}))

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$sql = @"
SELECT rootfile.baseName , rootfile.extension , Image.fileWidth AS width , image.fileHeight AS height ,

View File

@@ -1,6 +1,6 @@
#requires -modules "getSql"
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
#download f1Results from https://1drv.ms/f/s!AhfYu7-CJv4egbt5FD7Cdxi8jSz3aQ and update the path below
Get-SQL -Session f1 -Excel -Connection C:\Users\mcp\OneDrive\Public\F1\f1Results.xlsx -showtables -Verbose

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$path = "$env:TEMP\testBackgroundColor.xlsx"

View File

@@ -1,4 +1,4 @@
try { . $PSScriptRoot\..\..\LoadPSD1.ps1 } catch { }
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$xlfile = "$env:TEMP\SalesByQuarter.xlsx"
Remove-Item $xlfile -ErrorAction SilentlyContinue

View File

@@ -1,4 +1,4 @@
try { . $PSScriptRoot\..\..\LoadPSD1.ps1 } catch { }
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
class data {
[datetime]$Date

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
#. ..\New-PSItem.ps1

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
Remove-Item .\testFormula.xlsx -ErrorAction Ignore

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
Remove-Item "$env:temp\functions.xlsx" -ErrorAction SilentlyContinue

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
Remove-Item "$env:temp\hyperlink.xlsx" -ErrorAction SilentlyContinue

View File

@@ -1,4 +1,4 @@
try { . $PSScriptRoot\..\..\LoadPSD1.ps1 } catch { }
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$xlfile = "$env:TEMP\test.xlsx"
Remove-Item $xlfile -ErrorAction SilentlyContinue

View File

@@ -1,5 +1,5 @@
# https://raw.githubusercontent.com/dfinke/ImportExcel/master/images/NewExcelStyle.png
try { . $PSScriptRoot\..\..\LoadPSD1.ps1 } catch { }
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$xlfile = "$env:TEMP\test.xlsx"
Remove-Item $xlfile -ErrorAction SilentlyContinue

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$xlfile = "$env:Temp\testData.xlsx"
Remove-Item $xlfile -ErrorAction SilentlyContinue

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$xlfilename=".\test.xlsx"
rm $xlfilename -ErrorAction Ignore

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
. $PSScriptRoot\TestAPIReadXls.ps1

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$file = "C:\Temp\test.xlsx"

View File

@@ -1,4 +1,4 @@
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
. .\ConvertExcelToImageFile.ps1

View File

@@ -1,3 +0,0 @@
if($null -eq (Get-Module -ListAvailable ImportExcel) ) {
Import-Module $PSScriptRoot\ImportExcel.psd1 -force
}