That is the most screwed up set of tables!
There are 5 tables in that page. Some of them actually work (i.e., there’s a header for each column). The rest of them either use a non-breaking space for the 1st column header (which sometimes seems to throw the script into situation where it throws an exception), or puts the column header in one table and then the data in the following table (e.g., tableindex 2 and 3).
Without trying to debug author’s script, this is the best I could come up with:
$w = Read-HtmlTable.ps1 -InputObject c:/junk/powerenergy_mhtml.htm -tableindex 0 # -Header ‘Instantaneous’,’Pos Average’,’Neg Average’ $x = Read-HtmlTable.ps1 -InputObject c:/junk/powerenergy_mhtml.htm -tableindex 1 # skip tableindex2 — it casses an exception $y = Read-HtmlTable.ps1 -InputObject c:/junk/powerenergy_mhtml.htm -tableindex 3 -Header ‘1’,’2′,’3′,’4′ $z = Read-HtmlTable.ps1 -InputObject c:/junk/powerenergy_mhtml.htm -tableindex 4 -Header ‘1’,’2′,’3′
Source