google-sheetsweb-scrapinggoogle-sheets-formulaworld-of-warcraft

ImportXML extract table into Google Sheets


I'm trying to extract the whole following Warcraftlog table in a Google Sheets. I just need the "names" with "count" and the "percentage numbers".

=IMPORTXML("URL"; "XPATH")
=IMPORTXML("https://classic.warcraftlogs.com/reports/P4CQdFTp21wADfKX/#boss=-3&difficulty=0&type=auras&ability=31035"; "//table[contains(@id,'main-table-0')]")

But it doesn't work with //table[contains(@id,'main-table-0')] in the Xpath. With //table/tr/td it will extract nearly everything on the warcraftlog website, except the table I want to extract.

Is there another option to extract them with XPath?


Solution

    1. You are after an html table so switch to IMPORTHTML
    2. Data is pulled dynamically from another endpoint you can find in the network tab of the browser, so make your request to that
    3. The last two webpage visible table columns are $ delimited in the retrieved table so you will need to split the entries e.g. using helper column in column D of sheet (if formula in A1) containing SPLIT

    =IMPORTHTML("https://classic.warcraftlogs.com/reports/auras/P4CQdFTp21wADfKX/0/0/6175385/buffs/31035/0/0/0/0/source/0/-3.0.0/0/Any/Any/0", "table",1)
    

    enter image description here