+ Reply to Thread
Results 1 to 14 of 14

Importing data from a website using vba

  1. #1
    Registered User
    Join Date
    03-30-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    21

    Importing data from a website using vba

    Hi Folks,

    Need help with a vba code for importing data from "http://www.bseindia.com/" website.

    I was trying to import data from the financials of the companies listed on the site using their "scrip codes".

    for example, Importing data for "Infosys Ltd." whose scrip code 500209 sitting at the link "http://www.bseindia.com/corporates/results.aspx?Code=500209&Company=INFOSYS LTD.&qtr=80.00&RType=c"

    I struggle to reading html/java written in the source code of the webpage...would appreciate if anyone can help me out with a solution to this.

    Thanks in advance,

    Amber

  2. #2
    Forum Contributor
    Join Date
    02-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    187

    Re: Importing data from a website using vba

    The easiest way I have found is to record a macro, then use the import data from web tool. Then you can point it (assuming the data is in tabular form) to exactly what you want. You can then tinker around with the recorded code to remove the 'fat'.

  3. #3
    Registered User
    Join Date
    03-30-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Importing data from a website using vba

    I was trying to extract the table from "http://www.nseindia.com/live_market/dynaContent/live_watch/equities_stock_watch.htm" using the suggested method, however the same isn't working in this case.

    How can the table be extracted from the webpage given above?

    Please advice.

  4. #4
    Registered User
    Join Date
    03-30-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Importing data from a website using vba

    Can somebody help me out with solution for this please???...I am finding it difficult to read the source code of this webpage as I am new to html.

    this is urgent.

    Thanks in advance.

  5. #5
    Forum Contributor
    Join Date
    02-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    187

    Re: Importing data from a website using vba

    Sorry, as the data you want from that website isn't tabulated it won't be possible to use the method I gave above. Without a knowledge of the sourcecode of the website, it will not be possible to retrieve data from it.

    Sorry!

    Did the solution work for the initial website you requested for?

  6. #6
    Registered User
    Join Date
    03-30-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Importing data from a website using vba

    yes it did...thanks for that.

    Can you suggest me a wayout in this case.

  7. #7
    Forum Contributor
    Join Date
    02-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    187

    Re: Importing data from a website using vba

    I'm afraid without you picking up enough HTML (& possibly java) to understand the code of the website, there won't be a way to automate. You could of course use the 'download CSV' option on the website, if you just need the information periodically?

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Importing data from a website using vba

    Hello
    It will always be one of two options
    the quick way
    Please Login or Register  to view this content.
    or with java script the old slower way
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  9. #9
    Forum Contributor
    Join Date
    02-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    187

    Re: Importing data from a website using vba

    @Pike, very nice!

  10. #10
    Registered User
    Join Date
    03-30-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Importing data from a website using vba

    Thanks for the reply pike.

    Can you suggest a way for becoming proficient in reading the source code and the way it can be used for automation using vba...any book (in laguauge that can be understood by people who are new to html/java) or article...please advice.

  11. #11
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Importing data from a website using vba

    This site will help ... All the HTML Tags descriptions

  12. #12
    Registered User
    Join Date
    03-30-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Importing data from a website using vba

    Thanks pike

  13. #13
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Importing data from a website using vba

    another link http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
    google search will turn up heaps of helpful sites

  14. #14
    Registered User
    Join Date
    03-30-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Importing data from a website using vba

    @Pike tried to go through the suggested material on html and identify "LTP" & "Symbol" columns in the source code of "http://www.nseindia.com/live_market/dynaContent/live_watch/equities_stock_watch.htm" webpage.

    Its seemingly difficult for me to find out way to extract the columns or table placed in the link given above.

    Can you please help me out?

+ 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. Excel VBA Importing Website Data
    By kboyd757 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-09-2013, 06:25 PM
  2. importing external data from a website
    By ppg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2009, 09:46 AM
  3. Automatically importing data from a website
    By amawad98 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-21-2008, 01:18 PM
  4. Importing Data from a website to excel
    By sanmisds1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2005, 10:05 PM
  5. [SOLVED] Importing data from a website??
    By Galactik in forum Excel General
    Replies: 1
    Last Post: 01-29-2005, 11:07 PM

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