Forum Discussion

hasseljr's avatar
hasseljr
Copper Contributor
Dec 03, 2020

How to append data point to a table upon every API query refresh?

Hello,

 

I am using a Query to extract data from a web API. What I end up with is a table of my data that refreshes every minute. However, I need to keep a time-history of the data. Every time the query refreshes, I'd like it to append the new data to a table that keeps record of all the previous query responses. I can't figure out how to do this, is there a solution?

1 Reply

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    hasseljr 

    Do that first time and return the table into sheet, let say query name (thus table as well) is GetData. After that modify it - query itself, i.e. GetData table and append to data returned from web. That shall be done within ONE query, now as couple of separate ones. Script will be like

    let
        Source = Web.Content(), // if other steps append below the final one
    
        // query resulting table
        GetData = Excel.CurrentWorkbook(){[Name="GetData"]}[Content],
        AppendNextPortion = Table.Combine({GetData, Source})
    in
        AppendNextPortion