'How do I grab the entire table off a website and export it into excel
I am trying to grab the entire table from the website:
http://eweb.washco.utah.gov:8080/recorder/taxweb/account.jsp?accountNum=0972029
note: when you first click on the link, it will have you click a public login button. I have already created the bot to login and search through the website so, that is not the issue. I just need it to get the table off of the end result page that is linked above
table HTML: table class="AccountSummary"
and export it into an excel file.
I have tried a few methods but can't seem to get it working.
url=urllib.request.urlopen("http://eweb.washco.utah.gov:8080/recorder/taxweb/account.jsp?accountNum=0972029")
s = url.read()
html = etree.HTML(s)
tr_nodes = html.xpath(AccountSummary)
header = [i[0].text for i in tr_nodes[0].xpath("th")]
td_content = [[td.text for td in tr.xpath('td')] for tr in tr_nodes[1:]]
ff = open("output.csv", "w")
ff.write(str(s))
ff.close()
Solution 1:[1]
When I first clicked on your link, I had to click on a "public login" button first before I got to the table with my browser. Therefore I am guessing that table isnt even rendering when you use urllib.request.urlopen etc.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | swisstackle |
