+ Reply to Thread
Results 1 to 8 of 8

Web Crawling by VBA code

  1. #1
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    Web Crawling by VBA code

    Hi friends,

    Can we write a code in VBA and get a data from a website securely? I am seeking exchange rates data from central banks website (Bank of Canada).

    Thank you

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Web Crawling by VBA code

    Not sure what you mean by "securely". But, Bank of Canada provides API access to CSV, JSON & XML data.

    Ex: XML
    Please Login or Register  to view this content.
    To get CSV or JSON, you replace xml with csv or json respectively.

    There's various ways to import data to Excel (VBA, WebService() function, PowerQuery etc).

    See attached for sample WebService() method combined with FilterXML() for single day FX rate.

    See link for their documentation on Valet API.
    https://www.bankofcanada.ca/valet/docs
    Attached Files Attached Files
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    Smile Re: Web Crawling by VBA code

    Thank you CK76. Much appreciated.

  4. #4
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    Re: Web Crawling by VBA code

    Hi CK76,

    Can you please explain in brief the process that you carried out to extract this information? When I copy pasted the Filter Function formula, it gave the same result. I have attached the screenshot for your reference.

    Attachment 624628

    Thank you
    Roshan

  5. #5
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Web Crawling by VBA code

    FILTERXML returns array with multiple values. So you need to select range and then confirm using CTRL + SHIFT + ENTER.

    Have a read of link for more details.
    https://support.office.com/en-us/art...5-c1374812f5b7

    Alternately you can use INDEX() function to return result.
    Ex: In cell A4 enter below and copy down until you see #REF error. That means you've reached end of available record.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    Re: Web Crawling by VBA code

    Thank you CK76.

  7. #7
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Web Crawling by VBA code

    You are welcome and thanks for the rep

    If your question is resolved, please mark the thread as solved by using "Thread Tools" found at top of your initial post.

  8. #8
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    Re: Web Crawling by VBA code

    I am using this thread once again to get a formula or VBA code to fetch the data from the website that does not have API and requires authentication. I am trying to fetch the credit ratings data from S&P and Moody's for number of institutions without searching one by one.

    URL: https://www.moodys.com/
    URL: https://www.standardandpoors.com/

    Credit ratings data of Amazon Inc., Google LLC etc.

    For authentication, I have created a GMAIL account - [email protected] with password - developerstest1

    Should you have any queries, please let me know.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Need help with VBA code. Tons of code seperated in two, second part of code doesn't work.
    By FragaGeddon in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 11-30-2015, 11:46 AM
  2. [SOLVED] Crawling list of web pages for specific value(s) on page
    By an_otter in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 11-17-2015, 01:45 AM
  3. [SOLVED] Pattern Building VBA Code - Working code, would like to use cleaner code
    By Benisato in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-10-2015, 03:05 PM
  4. [SOLVED] Excel VB code. Message pops up while code running asking question. Code must not wait.
    By Heinrich Venter in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-28-2014, 06:10 AM
  5. QBR Crawling Inbox into Zipped File
    By jocelyn.gillespie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-17-2014, 10:46 AM
  6. We're crawling through mud today
    By jaslake in forum The Water Cooler
    Replies: 38
    Last Post: 08-22-2013, 11:17 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1