google-sheets-formula - 如何通过 IMPORTXML 从 Google 表格中的图书网站获取维度
问题描述
这就是我使用谷歌表格获取产品详细信息的方式
=IMPORTXML("https://www.bookdepository.com/Wings-of-War-James-P-Busha/9780760348529","//ul[@class='biblio-info']//li//span")
但我只需要维度。我怎样才能拿到那个?
我已经尝试了 3 天,但似乎无法弄清楚。太感谢了!
解决方案
您可以使用 Chrome 的 DevTools (F12) 获取 XPath。
=IMPORTXML("https://www.bookdepository.com/Wings-of-War-James-P-Busha/9780760348529","/html/body/div[2]/div[5]/div/div/div[1]/div[3]/div/ul/li[2]/span")
选择:
=IMPORTXML("https://www.bookdepository.com/Wings-of-War-James-P-Busha/9780760348529","//ul[@class='biblio-info']//li[2]//span")
仅提取维度:
=TRIM(REGEXEXTRACT(IMPORTXML("https://www.bookdepository.com/Wings-of-War-James-P-Busha/9780760348529","//ul[@class='biblio-info']//li[2]//span"),"^(.+)\|"))
推荐阅读
- c# - 使用 EPPlus 复制相关公式不起作用
- c# - 为什么在尝试将调试过程附加到 Microsoft Azure 应用服务时出现错误?
- spring-boot-admin - Eureka 服务 UP,SBA DOWN
- mysql - 如何在 MySQL 中检查一个 SELECT 的结果是否包含另一个 SELECT?
- python - 根据时间序列将大熊猫数据框拆分为较小的数据框
- java - 是否可以在 java 应用程序中使用 jQAssistant 作为工具?
- reactjs - 当单个组件更新时,为什么所有组件都会更新相同的值?
- cloud - 带有简单 wordpress 站点的 aws cloud front ssl
- sparql - SPARQL:找出用于链接的属性
- java - 如何使用反射抽象(减少)代码以获取字段(整数、长整数、浮点数、双精度)并进行一些计算?