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

3
  • Possible duplicate of How to extract specific tables from html file using native powershell commands? Commented Jun 1, 2016 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 Commented Jun 1, 2016 at 15:49
  • Variable, file, memory stream, cloud... it's all 'data' and can be parsed, dissected, and handled equally in the end. Commented Jun 1, 2016 at 15:50

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

1 Comment

I've stripped the table down to pretty basic tags: 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.