我在 Google Sheets IMPORTXML 函数中的 XPath 查询中苦苦挣扎。我正在尝试从该站点获取表格。使用 only//tr
显然给了我网站上的所有表格行。因为我想要一个特定的表,所以我需要表 id 来钻取结果。
表id(和类)如下:
<table class="leaguetable sortable table detailed-table fixed-wide-table" id="page_competition_1_block_competition_tables_7_block_competition_form_table_1_table">
在此处查看我当前的功能和查询。
=IMPORTXML("https://us.soccerway.com/national/england/premier-league/20182019/regular-season/r48730/","//table[@id='page_competition_1_block_competition_tables_7_block_competition_form_table_1_table']/tr")
在电子表格中使用这个公式会给我#N/A
和错误消息Imported content is empty
。
我使用 Chrome 扩展程序测试了查询,它给了我想要的结果。但不幸的是,该表格没有出现在我的电子表格中。