I'm trying to use the IMPORTXML function on Google Sheets.
For example:
=IMPORTXML("https://www.tiktok.com/@charlidamelio?lang=en", XMLPATH)
should return "72.6M"
I used the Chrome inspector to copy the xpath, which gives me:
/html/body/div[1]/div/div[2]/div/div[1]/div/header/h2[1]/strong[2]
When I try this in Google Sheets it returns an error: #N/A (Import Content is Empty).
P.S. I'm open to other ways to get the data I need into the google sheet, it doesn't have to use the IMPORTXML function.
I asked this question a while ago and someone gave me the following solution:
=REGEXEXTRACT(IMPORTXML(C2,"//script[@id='__NEXT_DATA__']"),"followerCount"":(\d+)")
This worked great for a while but has since stopped working.