Hey guys. I am totally stuck trying to pull a table out of some HTML.
I am logging onto a website and pulling back the HTML information but for the life of me, I can’t seem to get that data into a useful format.
I’m scraping using ‘New-Object -com’ because I couldn’t work out how to use ‘Invoke-Webrequest’ and log in so I fell back to InternetExplorer.Application as this was working for me (plus I can set it to visible and see it).
After login I am collecting the information like so
$tables = @($ie.Document.getElementsByTagName('table'))
and inside that, I have a field called ‘innerHTML’ that contains my table. I just can’t work out how to convert the information in that table into something readable and I’m wanting to perform a foreach at the end to upload some cells via an API to another site.
I’ve tried converting to XML\JSON, and splitting on "`n"I’ve followed every link on the internet that I can find and tried all their solutions but none seem to work for me. I have also tried a bunch of functions sourced from the net but they also no data returned.
I have put an edited copy of the table in this pastebin… it only has 2 rooms, but my original data will have 50 (unless I can work out how to return all object and not just the first page, then it will have about 300)
If anyone could point me in the right direction as i’m all out of ideas?
I think that this would be a fairly common task in PowerShell so I’m guessing that I just don’t know the terminology to search for it on google.