Search code examples
google-sheetsgoogle-sheets-formula

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

  • Try

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

    or

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

    enter image description here