IMPORTDATA shows empty output - xpath

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')]"))

Related

Import XML of span element fails with #N/A

finally decided to sign up to stackoverflow because of this. So I´d be super grateful about a solution!
I´m trying to get a number of a <span> element. Here is an image of the data box I´m trying to scrape from. It´s on this page: https://de.marketscreener.com/kurs/aktie/SNOWFLAKE-INC-112440376/analystenerwartungen/
The relevant Xpath is //*[#id="highcharts-0oywbsk-200"]/div[2]/div/span/span
I´m trying: =IMPORTXML("https://de.marketscreener.com/kurs/aktie/SNOWFLAKE-INC-112440376/analystenerwartungen/"),"//div[2]/div/span/span")
I´m ignoring the #id-element, this works pretty well with many elements on the same page, but in this case not at all. I ignore the id, because I can´t use it as it changes on every page. Is this ok?
Google Sheets always gives me a #N/A error?! Any idea how to scrape that number?
disabling JavaScript reveals what you can scrape:

Using Google Sheets for web scraping. Need the correct xpath for IMPORTXML function

There is a google sheet containing a list of MPN's (manufacturer part numbers). Trying to scrape a site called wikiarms for the UPC Codes when I have the MPN for an item.
I have the correct formula for doing this on another site.
=IMPORTXML("http://gun.deals/search/apachesolr_search/"&B1,"//dd/a[../../dt[contains(text(),'UPC')]]|//dd/span[../../dt[contains(text(),'UPC')]]")
Trying to figure out what the correct xpath to complete this formula. Some videos I have watch said to open the page in Chrome and use inspector to select and copy the xpath to complete the importxml function. I tried this with no luck.
Sample
Visit https://www.wikiarms.com/guns?q=20071
In the table there is a button "available in 6 stores" click that to reveal the list. The UPC should be listed after the MPN.
If I copy the xpath in Chrome this is the result
/html/body/div[1]/div/div/div[2]/div/div/div[2]/div[2]/table/tbody/tr[2]/td[5]
=IMPORTXML("https://www.wikiarms.com/guns?q="&B2,"xpath here")
What do I have to add at the end of this formula to pull in the UPC code? I will be using this formula to pull in UPC code for about 1000 items.
Thank you for your help.
Using your sample link, try
=IMPORTXML("https://www.wikiarms.com/guns?q=20071","//td[#class='upc']/a/#title")
and see if it works for you.

Conditional formatting based on another sheet in Google sheets

I googled for it and looked into many answers here, but it seems still not working for me.
I try to use this conditional formatting:
EXACT(A3,(INDIRECT("U_automatikus!A1:A")))
Here are the screenshots of my sheets.
Why it isn't doing anything?
My aim is to mark those in the first sheet which are present in the second too.
=FILTER(A1; COUNTIF(INDIRECT("U_automatikus!A$1:A"); A1))
demo spreadsheet

Google sheets Filter formula for text containing

I am unable to make the below filter formula work. Notice that I am trying to refer to the sheet "Data" and filter them into another sheet. I get error saying there were no matches.
=FILTER(Data!A3:Data!J, ARRAYFORMULA(REGEXMATCH(Data!J3:Data!J, ".*km.*")))
However, the above formula works when I insert it in the "Data" sheet. Notice that "Data!" is removed as it is in same sheet.
=FILTER(A3:J, ARRAYFORMULA(REGEXMATCH(J3:J, ".*km.*")))
I tried using the below sets with same results.
=FILTER(A3:J, REGEXMATCH(J3:J, ".*km.*"))
=FILTER(Data!A3:Data!J, REGEXMATCH(Data!J3:Data!J, ".*km.*"))
I have no problems filtering dates, numbers from "Data" sheet into my filtering sheet. It is only with "text contains" condition. Any help to resolve this is appreciated.
The formula was wrong. I was using the "Data!" twice. The below code works. Phew! Switching between languages (autohotkey, html, javascript, LibreOffice basic) seems to be taking a toll.
=FILTER(Data!A3:J, REGEXMATCH(Data!J3:J, ".*km.*"))

My importXML + xPath + Soundcloud playlist Not Working

So How To Use importXML By Google Docs Spreadsheet Plus xPath To Help Me Copy Soundcloud Playlist Track Title?
Today I'm looking for a solution on how to copy the Track Title of tracks inside a Soundcloud Playlist/Compilation.
I searched around and discovered importXML function offered by Google Docs Spreadsheet. While digging further about the importXML function, I discovered about xPath.
Great combination! I thought.
So I quickly get my hands on the tools and tested it, and it's great! I've extracted some data. And so I decided that I'm ready to implement the tool and use it with Soundcloud.
But when I tried to implement the syntax, I got an error saying Import Internal Error
The Syntax Is
=IMPORTXML(A1,"//div[#class='sc-media-content']/a[#title]")
<div class="sc-media-content"> is the div that holds the Track Title of the song, that is enclosed within an anchor tag with title attribute.
Here is the html block for it;
<div class="sc-media-content">
<a class="soundTitle__title sc-link-dark sc-truncate " href="/seven-lions/velvetine-the-great-divide?in=thedubstepgod/sets/melodic-dubstep-chillstep" title="Velvetine - The Great Divide (Seven Lions Remix)">
Velvetine - The Great Divide (Seven Lions Remix)
</a>
What I'm trying to extract is the Velvetine - The Great Divide (Seven Lions Remix). A1 is the cell where the Soundcloud Playlist Link is pasted into.
Other Syntax I've Tried
I've tried other syntax too, like;
=IMPORTXML(A1,"//div[#class='sc-media-content']/title")
As suggested here
=IMPORTXML(A1,"//div[#class='sc-media-content']/#title") From an answer found here, though it wasn't an accepted answer.
So what am I doing wrong? How could I copy those soundcloud playlist title to my Google Docs Spreadsheet using xPath?
UPDATE
Based from the answer given by TGH, this should work //div[#class='sc-media-content']/a/text().
But, the problem is that the div block that we're looking for is not in the source code. I did a view source code on the Playlist's page and the div block is not there. All I'm seeing is JavaScripts. So JS is loading the div blocks/classes.
So another question might be needed to help solve this one
How to use xPath with JavaScript loaded html elements?
Try the following
//div[#class='sc-media-content']/a/text()
Or if you want to grab it from the title do this
//div[#class='sc-media-content']/a/#title
I tested it here and it seems to work. Pasted your html, but had to close the div manually.
http://www.unit-testing.net/Xpath

Resources