IMPORTXML anchortext google table - google-sheets-formula

I need to import anchortexts in a column and have so far the following line which unfortunately doesn't work:
=IMPORTXML("https://playtoearn.net/blockchaingames/Polygon/All-Genre/All-Status/All-Device/All-NFT/All-PlayToEarn/All-FreeToPlay";"//tbody/tr/td/a[#data-original-title]")
Does someone know how to get the yellow marked data-original-titles text (e.g.Wamix) into the column?:

Related

Import data to Google sheet from a live website

I want to import villages data from state government website (Madhya Pradesh State in India). The website is http://saara.mp.gov.in/saaraweb/PublicReport/frm_PerWiseGirdavariStatus.aspx In this page the report is shown off all the district of Madhya Pradesh State. I want to import all the villages data. My target district is "37-सिवनी". The district name is in first column and its position changes according to the percentage of work done by all the districts. When I click on the "37-सिवनी" the javascript shows me all the tahsil(towns) of "37-सिवनी" which are 08. My target town is "06-घंसाैर" its position also changes according to the work done percentage by all towns. When I click on "06-घंसाैर" the list of villages of "06-घंसाैर" is now shown with the desired data I want. I want this data to be imported automatically to my googlesheet in specific time. I tried importhtml and importxml but it did not work for me as the data is not directly available in the url http://saara.mp.gov.in/saaraweb/PublicReport/frm_PerWiseGirdavariStatus.aspx. Do some know how to import data which shows after clicking on some javascript object. It will be very helpful for me. https://docs.google.com/spreadsheets/d/1FfjDh5-z0EIZ5GBOrKElgi3dkRtJX_4BW3imTLUu7ds/edit?usp=sharing In the sheet "want" you can see the type of data I want to import and in "got" sheet is the data what I got when I try to import using importhtml function.
Google Sheets does not support scraping JavaScript content/elements so the best you can have is:
=IMPORTHTML("http://saara.mp.gov.in/saaraweb/PublicReport/frm_PerWiseGirdavariStatus.aspx";
"table"; 1)
you can easily test what can be imported simply by disabling JS for a given site like this:

IMPORTXML How to format imported text without line breaks?

I'm using the IMPORTXML formula in a cell to import text. The text on the web page doesn't have defined line breaks, nor does the source code, but the import I get does. I need it to be one string, so I can format it correctly.
=importxml("https://elite.finviz.com/quote.ashx?t=AAPL&ty=l&ta=0&p=m", "//td[#class='fullview-profile']")
The text breaks that I get
I found a solution. Wrapping the formula in Clean()
=clean(importxml("https://finviz.com/quote.ashx?t=AAPL&ty=l&ta=0&p=m", "//td[#class='fullview-profile']"))

IMPORTDATA shows empty output

I have a IMPORTDATA that has been working well. A week ago it started to show "empty output". I tried changing the formula but so far no luck.
Formula + url here
I expect the result to extract tags from the url.
I've tried IMPORTXML
You need to use the IMPORTXML function rather than IMPORTDATA. I've added a tab to your sheet.
try it like this:
=IMPORTXML(A2, "//span[#class='text-largest strong override-listing-price']")
=TRANSPOSE(IMPORTXML(A2, "//a[contains(#class,'btn btn-secondary')]"))

xpath query to a specific number on a page

I couldn't manage to write the correct XPATH code to import a number from the following page into my google sheet cell. I want to use the IMPORTXML function of google sheet.
Any help is highly appreciated in advance.
Source page: https://www.xe.com/currencycharts/?from=USD&to=AED
The number I want to insert into a cell is shown below
Tried
//div[#id='rates_detail_desc']/strong[2]

Importxml Imported Content Empty

I encounter the error message imported content is empty when I use the formula below in google spreadsheet.
=IMPORTXML("https://www.moh.gov.sg/content/moh_web/home/pressRoom.html", "//div[#class='article highlight']/h3/a/#title")
I am trying to import the list of press release title on the webpage.
What am I doing wrong?
So this issue is not your formula or XML in this particular case, its that the content is loaded using jQuery, so you need to figure out where or what the url is that actually holds your content.

Resources