mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Added try/catch. Expanded aliases
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
ipmo C:\Users\mcp\Documents\GitHub\ImportExcel\ImportExcel.psd1 -Force
|
||||
try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
Get-SQL -Session f1 -Excel -Connection C:\Users\mcp\OneDrive\Public\F1\f1Results.xlsx -showtables -Verbose
|
||||
|
||||
del .\demo3.xlsx
|
||||
Remove-Item .\demo3.xlsx
|
||||
$session = $DbSessions["f1"]
|
||||
|
||||
$SQL = "SELECT top 25 DriverName, Count(RaceDate) as Races ,
|
||||
Count(Win) as Wins, Count(Pole) as Poles, Count(FastestLap) as Fastlaps
|
||||
FROM Results GROUP BY DriverName
|
||||
order by (count(win)) desc"
|
||||
$Excel = Send-SQLDataToExcel -SQL $sql -Session $session -path .\demo3.xlsx -WorkSheetname "Winners" -AutoSize -AutoNameRange -BoldTopRow -FreezeTopRow -Passthru
|
||||
$SQL = "SELECT top 25 DriverName, Count(RaceDate) as Races ,
|
||||
Count(Win) as Wins, Count(Pole) as Poles, Count(FastestLap) as Fastlaps
|
||||
FROM Results GROUP BY DriverName
|
||||
order by (count(win)) desc"
|
||||
$Excel = Send-SQLDataToExcel -SQL $sql -Session $session -path .\demo3.xlsx -WorkSheetname "Winners" -AutoSize -AutoNameRange -BoldTopRow -FreezeTopRow -Passthru
|
||||
|
||||
$ws = $Excel.Workbook.Worksheets["Winners"]
|
||||
$ws = $Excel.Workbook.Worksheets["Winners"]
|
||||
|
||||
Set-Row -Worksheet $ws -Heading "Average" -Value {"=Average($columnName`2:$columnName$endrow)"} -NumberFormat "0.0" -Bold
|
||||
Set-Column -Worksheet $ws -Heading "WinsToPoles" -Value {"=D$row/C$row"} -Column 6 -AutoSize -AutoNameRange
|
||||
|
||||
Reference in New Issue
Block a user