我正在整理一個電子表格,這樣我就可以跟蹤我的商店預購的商品并制作它,以便在庫存水平變化時更新。我想得到它,所以我的作業表告訴我網頁按鈕是說預訂還是添加到購物籃。有時這有效,有時則無效。這是我的公式:
=IMPORTXML("https://www.smythstoys.com/uk/en-gb/video-games-and-tablets/gaming-merchandise/harry-potter-lumos-logo-light/p/209816","//html/body/div[7]/section/div/div/div[2]/div[1]/div[5]/div/div/div/div[2]/form/button")
這個特定的似乎回傳 N/A。除了嘗試自學之外,我不太了解 Importxml 或 HTML 的詳細資訊,以了解為什么這可能會或可能不會起作用。我還想知道是否可以只檢索某些文本位而不是全部。所以,我有這個:
=IMPORTXML("https://www.smythstoys.com/uk/en-gb/video-games-and-tablets/gaming-merchandise/harry-potter-lumos-logo-light/p/209816","//html/body/div[7]/section/div/div/div[2]/div[1]/div[5]/div/div/div/div[2]/form/div[1]/span[14]/table/tbody/tr/td[2]")
回傳“缺貨。預計 2022 年 8 月有貨”。是否可以僅檢索該文本的“2022 年 8 月”部分?非常感謝任何可以提供幫助的人。
uj5u.com熱心網友回復:
回傳按鈕
=index(importxml(url,"//button[@id='addToCartButton']"),1,1)
僅獲取可用日期
=regexextract(IMPORTXML(_______________),".*: (.*)")
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/496019.html
