1
votes

I'm trying to use the IMPORTXML function in Google sheets to grab the meaning and information words on https://www.powerthesaurus.org/

I kind of succeeded getting some data from another website, but as a newbie, I got some troubles to get any data when I try on this one in this Google sheet in D6 cell.

=ImportXML("https://www.powerthesaurus.org/"&A6,"//*[@id='link link--primary link--term']")

Could someone help to educate me with the correct formula?

1

1 Answers

2
votes

You're looking for synonyms. Note you can display up to 200 on Power Thesaurus. To get the 50 first synonyms in one cell (since you have one word per row), you can try this :

Create 50 numbered columns in your GoogleSheet. Apply this formula to the first cell and drag it to the right.

=IMPORTXML("https://www.powerthesaurus.org/abbreviation/synonyms";"(//div[@class='pt-thesaurus-card__term'])"&"["&B2&"]")

Then use join formula to get all the words in one cell (XX:XX is the range of your columns, B3:F3 on the provided screenshot).

=JOIN("|";XX:XX)

Result :

Synonyms

Alternatively we could have use this one-liner (and make some cleanup afterwards) but GoogleSheet returns a blank cell whereas the XPath is perfectly valid :

=IMPORTXML("https://www.powerthesaurus.org/abbreviation/synonyms";"normalize-space(//div[@class='pt-list-terms__container'])")