'Using IMPORTXML to just retrieve the closing date and nothing else
I need to scrape just the closing date on a website onto google sheets.
currently using =IMPORTXML(A1,"//*[@id]") but it scrapes all the data on the site.
I need just the closing date right at the bottom of this page, is this possible? https://justicejobs.tal.net/vx/lang-en-GB/mobile-0/appcentre-1/brand-15/xf-5ebef95e1d21/candidate/so/pm/1/pl/3/opp/54025-202202-Prison-Officer-HMP-Leicester/en-GB
Solution 1:[1]
Try
=IMPORTXML(A1, "//p/span/span/strong/span")
or
=REGEXEXTRACT(IMPORTXML(A1, "//p/span/span/strong/span"),"Closing date (.*)\.")
Solution 2:[2]
try:
=QUERY(FLATTEN(IMPORTXML(A1, "//*[@id]")),
"where lower(Col1) starts with 'closing date'")
or just a date:
=REGEXEXTRACT(QUERY(FLATTEN(IMPORTXML(A1, "//*[@id]")),
"where lower(Col1) starts with 'closing date'"), "(\d+.*).")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mike Steelson |
| Solution 2 |



