Forum Discussion

queryfan's avatar
queryfan
New Member
9 years ago

How to load Data from a webpage having multiple pages

Hello,

 

I am trying to import data using the below query , But I am able to import only the first 30rows in table0..How do I loop to the next table and import the remaing?

 

Please suggest necessary changes to the 'M' code

 

URL: http://www.moneycontrol.com/markets/earnings/latest-results/latest/yoy/standalone/

 

let
    Source = Web.Page(Web.Contents("http://www.moneycontrol.com/markets/earnings/latest-results/latest/yoy/standalone/")),
    Data0 = Source{0}[Data],
    #"Changed Type" = Table.TransformColumnTypes(Data0,{{"Company Name", type text}, {"Sales (Rs Crore) Dec 2016", type number}, {"Sales (Rs Crore) Dec 2015", type number}, {"Sales (Rs Crore) % Chg", type text}, {"Gross Profit (Rs Crore) Dec 2016", type number}, {"Gross Profit (Rs Crore) Dec 2015", type number}, {"Gross Profit (Rs Crore) % Chg", type text}, {"Net Profit (Rs Crore) Dec 2016", type number}, {"Net Profit (Rs Crore) Dec 2015", type number}, {"Net Profit (Rs Crore) % Chg", type text}})
in
    #"Changed Type"

Thank you.

9 Replies

    • queryfan's avatar
      queryfan
      New Member

      Thank you

       

      I have no knowledge about the parameters in the URL.

       

      Could you please let me know how to identify the variable so that I could loop through all the sheets and get the data using power query.

      • v-qiuyu-msft's avatar
        v-qiuyu-msft
        Icon for Community Support rankCommunity Support

        Hi queryfan,

         

        You can't just use the site URL to get table data in desktop simply. You need to view corresponding API and find the actual URL to get all table data. So the first thing you need to do is contacting Money Control to find the rest API to get data. Then you can follow this simple to do it in desktop: How to call REST APIs and parse JSON with Power BI

         

        Best Regards,
        Qiuyun Yu

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi! I have the same situation as you.  Were you able to find a way to get all the pages? Parameterizing the query won't work for our scenario because the URL doesn't have the page number.  In fact, it doesn't change when we switch page by clicking the other page numbers at the bottom.

     

     

    Regards,

     

    Ferdinand

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello Anonymous,

       

      I am running into the same dilemma as you are.

       

      Have you had any luck finding help with this issue?

       

      Please let me know. Thanks.

       

      -K

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hello Anonymous,

         

        Sorry I wasn't able to find a solution.  I ended up just settling for getting just the data on the default page (first page).  Just to clarify, the issue is not being able to get additional pages from a URL if the webpage uses javascript for pagination because the URL remains the same even if you navigate the table to next pages.

         

         

        Regards,

         

        Ferdinand