Google Sheets - trailing data capture

saor

Honorary Master
Joined
Feb 3, 2012
Messages
42,204
Reaction score
37,114
Location
CPT
I have a document that pulls in data via a script from another site. The API the data pulls from doesn't permit any historical data queries, but what I'd like to do is every time I refresh my document and it pulls in fresh data, is to keep a record of that data for x days or x amounts of refreshes.

So, an example document:
sheets.png

I manually refresh the sheet and columns A and B get populated with say, share prices for companies. What I'd like is for columns DEF to keep track of the prices and to then get overwritten as the prices update, such that there's only ever a trailing history n intervals long (3 intervals in the example above.). Else it can just insert the price into column D and shift everything to the right to infinity.

Another issue I have is the share prices come into the document in random orders, so any record would have to query the ID and dynamically move the records to match the new row where the ID is located, and also account for new ID's appearing and keeping track of them too.

Bit of a long shot, would probably need a custom script written but hey - worth asking anyway.
 
Last edited:
I would pull the data to a datasheet and then use another sheet to sumarise this data.
The datasheet will have every pull that the doc has done so it will be massive, Then using vlookups on primary keys to link historical pricing should be a breeze.
 
I started using such tables at the beginning of the pandemic, but I didn't like their convenience. Are there tables more suitable for this?
Another old thread?
 
Top
Sign up to the MyBroadband newsletter
X