The main problem here is that the prices in the Steam page are generated by Javascript and IMPORTXML
cannot retrieve dynamically generated data. It seems that you're trying to get around this by importing a <script>
section, but this will not execute the script, you're just grabbing a bunch of code.
According to this answer, Steam has some endpoints that you can use to get market data. These return a simple JSON string with the item information. The endpoint looks like this:
http://steamcommunity.com/market/priceoverview/?currency=1&appid=[ID]&market_hash_name=[Item name]
The appid
is the game's ID, and the market_hash_name
is the URL-encoded name of the item. Conveniently you can already find these in the URL that you are already using, https://steamcommunity.com/market/listings/730/Clutch%20Case
. The game ID is 730
and the name is Clutch%20Case
. So you can plug these in to the endpoint to get this URL:
http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=Clutch%20Case
The endpoint's JSON looks like this:
{
"success":true,
"lowest_price":"$0.30",
"volume":"94,440",
"median_price":"$0.31"
}
Since you only care about the median price, we can use a formula with REGEXEXTRACT
to extract only that part:
Here's a sample pasting the URL in A1.
=REGEXEXTRACT(JOIN("", IMPORTDATA(A1)), "median_price:""(\$[0-9]+.[0-9]+)")

Edit: As mentioned in the answer I linked, you can test the currency
parameter in the URL with different numbers to get other currencies. In your case you can try currency=2
for pounds (£). You'll also have to edit the REGEXEXTRACT
to account for this change:
URL: http://steamcommunity.com/market/priceoverview/?currency=2&appid=730&market_hash_name=Clutch%20Case
Formula: =REGEXEXTRACT(JOIN("", IMPORTDATA(A1)), "median_price:""(£[0-9]+.[0-9]+)")