在以下网址
中 http://www.indiavotes.com/ac/details/1/32051/216
有“EXPORT to CSV”的链接,但我在pagesource()中找不到表信息或download.csv链接。
如何使用R下载此csv?
答案 0 :(得分:0)
Sub DumpData()
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
URL = "http://www.indiavotes.com/ac/details/1/32051/216"
'Wait for site to fully load
IE.Navigate2 URL
Do While IE.Busy = True
DoEvents
Loop
RowCount = 1
With Sheets("Sheet1")
.Cells.ClearContents
RowCount = 1
For Each itm In IE.document.all
.Range("A" & RowCount) = itm.tagname
.Range("B" & RowCount) = itm.ID
.Range("C" & RowCount) = itm.classname
.Range("D" & RowCount) = Left(itm.innertext, 1024)
RowCount = RowCount + 1
Next itm
End With
End Sub