Forum Discussion

masplin's avatar
masplin
Impactful Individual
8 months ago
Solved

Excel Power Query Connecting to Datasource locks up all Office products

I have an excle based power query that has a bit of a convoluted query to extract stock data for UK stocks from a web page. Each stock runs 2 functions and there are 83 stocks.  This used to work abs...
  • v-echaithra's avatar
    v-echaithra
    8 months ago

    Hi masplin ,

    You don’t need to create a separate function for the delay. Just modify your existing QuoteUK/Yahoo function by wrapping the Web.Contents call with Function.InvokeAfter. In the earlier example, x was only a placeholder argument, it's not meant to be your function name.

    Here’s how your function should look once the delay is applied:

    let
    Url = "https://shareprices.com/lse/" & Yahoo & "/",

    Source =
    Function.InvokeAfter(
    () =>
    Web.Page(
    Web.Contents(
    Url,
    [
    Headers = [
    #"User-Agent" = "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    Accept = "text/html",
    #"Accept-Language" = "en-GB,en;q=0.9"
    ]
    ]
    )
    ),
    #duration(0,0,0,1)
    )
    in
    Source

    Hope this helps,
    Thank you.