Search code examples
parsinggoogle-sheetsimporthtml-parsing

IMPORTXML: how to scrape NBA logos from a webpage (with Google Sheets)


Webpage: https://www.sportslogos.net/teams/list_by_league/6/National_Basketball_Association/NBA/logos/

Tool: Google Sheets. Function: importxml

Query: I want to retrieve the link of the NBA logos with importxml.

Tries (without any success):

//a[@title='Atlanta Hawks Logos']/@content

//a[contains(@title,'Atlanta')]

How can I do this?


Solution

  • If you need the logo based on team_name:

    =image(importxml(A$1,"//*[@title='"&A2&" Logos']//img/@src"))
    

    enter image description here

    If you need all the images in one go:

    =importxml("Webpage","//img/@src")