Search code examples
regexgoogle-sheetssplitsteamimportdata

Extract date and numbers in google sheet from steam price history


I have this link with a lot of info: https://steamcommunity.com/market/pricehistory/?currency=1&appid=570&market_hash_name=Exalted%20Fractal%20Horns%20of%20Inner%20Abysm

I want to extract all the data of each date and put in a list divided in date, median price and quantity

I am using IMPORTDATA Function but doesn't support all the lenght of the data.

So I take it manually in a sheet:

https://docs.google.com/spreadsheets/d/1MR6jouxvYfbgEJYgMG6UFf0R7uhZascmFtViNEYPrPQ/edit#gid=836818346

Then I want to divide this in a list as:

Date Median Price Quantity
Nov 05 2022 23 193.82 4

I think it can be done with REGEXEXTRACT but I don't know what regular_expression to use.

Already figure out the date median price formula:

=ARRAYFORMULA(REGEXEXTRACT(FLATTEN(SPLIT(A2,"[")),"(.{3} \d+ \d{4}.{3}).+,(.+),"""))

Need and adjustment for show the quantity.


Solution

  • try:

    =INDEX(QUERY(QUERY(REGEXEXTRACT(FLATTEN(SPLIT(A2, 
     "[")), "(.{3} \d+ \d{4}).+,(.+),""")*1, 
     "select Col1,avg(Col2),count(Col1) group by Col1"), "offset 1", ))
    

    enter image description here


    UPDATE:

    =INDEX(REGEXEXTRACT(FLATTEN(SPLIT(A2, 
     "[")), "(.{3} \d+ \d{4}).+,(.+),""(\d+)"))
    

    enter image description here