Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
3 years ago
Solved

Expression.Error: 7 arguments were passed to a function which expects between 1 and 2. Details: Pattern= Arguments=[List]

I am trying to pull in stock ticker data from google.com/finance for different stocks and have gotten the error - "Expression.Error: 7 arguments were passed to a function which expects between 1 and...
  • v-yanjiang-msft's avatar
    3 years ago

    Hi Syndicate_Admin ,

    It looks like the error message is indicating that the Web.BrowserContents function is expecting 1 or 2 arguments, but you are passing in 6.

    Instead of using multiple Web.BrowserContents functions, you could try using the Web.Page function to load the page once and then extract the data for each stock ticker using a loop or list. Here's an example of how you could modify your query to use the Web.Page function:

    let
      tickers = {"DAL:NYSE", "NI:NYSE", "DG:NYSE", "MSFT:NASDAQ", "BBY:NYSE", "GOOG:NASDAQ"},
      url = "https://www.google.com/finance/quote/",
      stockData = List.Transform(
        tickers,
        each
          let
            tickerUrl = url & _,
            page      = Web.Page(tickerUrl),
            table     = page{0}[Data]
          in
            table
      ),
      combinedData = Table.Combine(stockData)
    in
      combinedData

    This code creates a list of ticker symbols, constructs the URL for each ticker, loads the page using Web.Page, extracts the data table from each page, and then combines all of the tables into a single table.

     

    Best regards,

    Community Support Team_yanjiang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.