Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
具有交替行的IMPORTXML表_Import_Google Sheets - Fatal编程技术网

具有交替行的IMPORTXML表

具有交替行的IMPORTXML表,import,google-sheets,Import,Google Sheets,我想使用Google Sheet IMPORTXML函数从Fangraphs页面只导入“1B”列 我能够使用此功能: =importxml("http://www.fangraphs.com/statsd.aspx?playerid=9166&position=C&type=1&gds=&gde=&season=2015", "//tr[@class='rgRow']/td[10]") 导入表中的其他每一行,因为该表被分为“rgRow”和“rgAltRo

我想使用Google Sheet IMPORTXML函数从Fangraphs页面只导入“1B”列

我能够使用此功能:

=importxml("http://www.fangraphs.com/statsd.aspx?playerid=9166&position=C&type=1&gds=&gde=&season=2015", "//tr[@class='rgRow']/td[10]")
导入表中的其他每一行,因为该表被分为“rgRow”和“rgAltRow”两类。但是,我需要导入每一行

我还想一直导入列表,而不是在每个新标题处停止


这怎么可能呢?我宁愿不要使用多个IMPORTXML函数以保持页面快速运行。

假设这是一个xpath查询,请尝试以下操作:

=importxml("http://www.fangraphs.com/statsd.aspx?playerid=9166&position=C&type=1&gds=&gde=&season=2015", "//tr[@class='rgRow']/td[10] | //tr[@class='rgAltRow']/td[10]")

注意,添加了
|
字符(表示“or”)和
//tr[@class='rgAltRow']/td[10]

Ahh的第二个表达式,这很有意义。谢谢你的帮助。