• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Power Query - Extract from web

? This site provides only top 10 gainer/loser. If you need more, contact them for their API.

Without API, you can scrape Top10 gainers only for this site with PowerQuery. As you won't be able to navigate within site.

You may be able to scrape cookie first and pass that info via query and scrape json response. But that's quite a bit more involved.

See link for some details on the process.
http://www.excelandpowerbi.com/?p=58

With API, you can set up various query requests directly to server and obtain info.
 
Last edited:
Had bit of time so tested. Looks like you don't need cookie string as long as it's stored in your local file. However, if it expires, you may need to implement the process outlined in the link provided.

See attachment for how json data is queried and transformed.
 

Attachments

  • Sample_Gainer_Loser_PQ.xlsb
    23.1 KB · Views: 26
Had bit of time so tested. Looks like you don't need cookie string as long as it's stored in your local file. However, if it expires, you may need to implement the process outlined in the link provided.

See attachment for how json data is queried and transformed.
Hello Chihiro,

This works for me.. Not sure on how to get securities greater than 20 field. tried looking for Json thing but couldnt get clue
 
Using browser of your choice, launch Developer tool or equivalent.

Navigate to site and click on security 20 field. Navigate to Network pane and go to XHR section.

Find the request sent and locate Request URL. That's what you need to get that info.

upload_2018-5-25_13-28-0.png
 
It can't easily be scraped without piloting browser.

If you inspect source code, you will notice that all table fields are populated java script.

One way to do it is use legacy Query from Web tool. Go to Options -> Data and check From Web (Legacy).

upload_2018-6-8_14-31-20.png

Then you can use in built browser to query entire web page.
upload_2018-6-8_14-32-1.png
 
It can't easily be scraped without piloting browser.

If you inspect source code, you will notice that all table fields are populated java script.

One way to do it is use legacy Query from Web tool. Go to Options -> Data and check From Web (Legacy).

View attachment 52814

Then you can use in built browser to query entire web page.
View attachment 52815
Chihiro,

Could you help me with the file. i tried this but getting the bugs on the jscript error
 
Back
Top