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

2 answers

  • answered 2022-05-04 10:20 player0

    try:

    =QUERY(FLATTEN(IMPORTXML(A1, "//*[@id]")), 
     "where lower(Col1) starts with 'closing date'")
    

    enter image description here

    or just a date:

    =REGEXEXTRACT(QUERY(FLATTEN(IMPORTXML(A1, "//*[@id]")),
     "where lower(Col1) starts with 'closing date'"), "(\d+.*).")
    

    enter image description here

  • answered 2022-05-04 11:39 Mike Steelson

    Try

    =IMPORTXML(A1, "//p/span/span/strong/span")
    

    or

    =REGEXEXTRACT(IMPORTXML(A1, "//p/span/span/strong/span"),"Closing date (.*)\.")
    

    enter image description here

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum