我一直在尝试使用谷歌表格导入,从网址https://www.pro-football-reference.com/years/2024/和https://www 中抓取各种球队表数据,但没有成功.pro-football-reference.com/years/2024/opp.htm
我从另一篇文章中找到了此代码。
在简单的网页抓取查询上使用 Google Sheets 的 ImportXML XPath 问题
它非常接近我的需求,但我无法将其调整为来自同一网站的类似数据。
查询部分提取正确的未解析数据。
QUERY(IMPORTDATA("https://www.pro-football-reference.com/years/2024/");"选择 Col1,其中 Col1 包含 'exp_pts_rush'")
所以我相信我对 REGEXREPLACE 的误解是问题所在。
如有任何帮助,我们将不胜感激
=ARRAYFORMULA(SPLIT(QUERY(ARRAYFORMULA(REGEXREPLACE(REGEXREPLACE(ARRAYFORMULA(SUBSTITUTE(QUERY(IMPORTDATA("https://www.pro-football-reference.com/years/2024/")));"选择 Col1,其中 Col1 包含 'exp_pts_rush '");">";">0"));".+排名.+?>(.+?)<.+team.+([A-Z]{3}).+g.+?>(.+?)<.+?rush.+?>(.+?)<.+?rush.+?>(.+?)<.+?rush.+?>(.+ ?)<.+?rush.+?>(.+?)<.+?rush.+?>(.+?)<.+?rush.+?>(.+?)<.+?fum.+?>(.+?)<.+?exp.+";"$1;$2;$3;$4;$5;$6;$7;$8;$9;$10;$11"));"select * WHERE NOT Col1 contains '<'");";"))