Import-Html.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function Import-Html {
    [CmdletBinding()]
    param(
        $url,        
        $index
    )
    
    $xlFile = (New-TemporaryFile).fullname -replace "tmp","xlsx"
    rm $xlFile -ErrorAction Ignore

    Write-Verbose "Exporting to Excel file $($xlFile)"

    Get-HtmlTable $url $index |
        Export-Excel $xlFile -Show -AutoSize
}