Forum Discussion

sesame5486's avatar
sesame5486
Frequent Visitor
2 years ago
Solved

Power Query only refreshes after refreshing preview

I'm using Power Query in Excel. I've created a query to extract data from Anaplan via APIs. The query works, but I can't refresh normally.   Using Refresh All triggers a query refresh, but the actu...
  • sesame5486's avatar
    2 years ago

    I solved the issue, but it raises another question!

     

    The process to download data from Anaplan is as follows:

    1. Authenticate and get an authentication token. This is used in future API requests.
    2. Trigger the download process in Anaplan. This only starts the download on the server side. No data is sent to Power Query.
    3. Download the data (from step 2).
    4. Transform data as required.

     

    Step 2 above is represented by this line:

    response2 = Json.Document(webdata2),

    This line is then no longer used in the query. All this does is start the download process on the server side, it is not used again in the query. Because it is not used, I don't think Power Query bothers to run it when refreshing the query. Why would it? The line doesn't impact the query. BUT, from an API perspective, I need this to be updated each time.

     

    This is why refreshing the preview worked, it forced Power Query to update this value and hence re-trigger the download process.