【发布时间】:2019-07-22 00:55:27
【问题描述】:
我正在尝试将下面链接的表格(Fangraphs)中显示的数据拉到我的 Google 表格中。
链接到网站上的表格:
使用 ImportHTML,我只能从链接中提取表 #1、2、3,它们都不是正确的表。
使用 ImportXML,我不断收到使用代码的公式解析错误:
=IMPORTXML("https://www.fangraphs.com/leaders/splits-leaderboards?splitArr=8,131&splitArrPitch=&position=B&autoPt=false&splitTeams=false&statType=player&statgroup=2&startDate=2014-03-01&endDate=2019-11-01&players=&filter=AB%7Cgt%7C5&sort=16,1&pageitems=10000000000000&pagenum=0","//*[@id="react-drop-test"]/div[2]/div/div[1]/div/div[1]/table)")
我试过的代码:
导入HTML:
=IMPORTHTML("https://www.fangraphs.com/leaders/splits-leaderboards?splitArr=8,131&splitArrPitch=&position=B&autoPt=false&splitTeams=false&statType=player&statgroup=2&startDate=2014-03-01&endDate=2019-11-01&players=&filter=AB%7Cgt%7C5&sort=16,1&pageitems=10000000000000&pagenum=0", "table",4)
导入XML:
=IMPORTXML("https://www.fangraphs.com/leaders/splits-leaderboards?splitArr=8,131&splitArrPitch=&position=B&autoPt=false&splitTeams=false&statType=player&statgroup=2&startDate=2014-03-01&endDate=2019-11-01&players=&filter=AB%7Cgt%7C5&sort=16,1&pageitems=10000000000000&pagenum=0","//*[@id="react-drop-test"]/div[2]/div/div[1]/div/div[1]/table)")```
I want the table headers and all the data below to be pulled into my Google sheet. I've done this with other Fangraph links.
【问题讨论】:
标签: xpath google-sheets html-table google-sheets-formula google-sheets-importxml