简体   繁体   中英

How to include a Google Sheets cell number in XPath for ImportXML

I'm playing with Google Scripts & Sheets.

I want to extract the text in p for every query in a specific url. This works:

=IMPORTXML("url", "//h3[text()=‘query’]/following-sibling::p[1]")

However, instead of copying and pasting each query, I have a column of almost 200 of them (I'm aware of the 50 limit). Is there a way to replace text()='query' with a cell? Eg

=IMPORTXML("url", "//h3[B3]/following-sibling::p[1]")

I've tried many variations of B3/what's contained in [] eg GetRange("B3"), all to no avail.

尝试使用标准字符串连接:

=IMPORTXML("url", "//h3["&B3&"]/following-sibling::p[1]")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM