0

Is it possible to convert an HTML table to a powershell csv?

I dont think there is a native way to do this through powershell, if anyone else has done something similar and would like to share code I would appreciate it greatly.

An example of the table is here http://pastebin.com/8pb7J97x

ertuu85
  • 79
  • 1
  • 6
  • Possible duplicate of [How to extract specific tables from html file using native powershell commands?](http://stackoverflow.com/questions/25940510/how-to-extract-specific-tables-from-html-file-using-native-powershell-commands) – gravity Jun 01 '16 at 15:41
  • The paste bin example will always be a variable and will never become a file, not sure I can use the IE example – ertuu85 Jun 01 '16 at 15:49
  • Variable, file, memory stream, cloud... it's all 'data' and can be parsed, dissected, and handled equally in the end. – gravity Jun 01 '16 at 15:50

1 Answers1

0

google gave me this, and it seems to work, but the result will likely need to be cleaned up because of the way your table is formatted

http://poshcode.org/561

Parse-HtmlTable -url 'https://dl.dropboxusercontent.com/u/14500910/tempfile.html' -tableNumber 2
Anthony Stringer
  • 1,981
  • 1
  • 10
  • 15
  • I've stripped the table down to pretty basic tags: http://pastebin.com/shTnE3iC and I still cant get 'parse-htmltable' to run it. I get You cannot call a method on a null-valued expression. At line:9 char:1 + $value = $value.trim() + ~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull – ertuu85 Jun 01 '16 at 16:34