+ Reply to Thread
Results 1 to 6 of 6

VBA Query to Download a CSV file and to import in the sheet

  1. #1
    Registered User
    Join Date
    04-30-2007
    Posts
    26

    VBA Query to Download a CSV file and to import in the sheet

    Hi,

    Need web query in Excel for the below mentioned website.

    http://www.nseindia.com/live_market/...tock_watch.htm

    When executed with excel web query throws error

    Thanks

    Sathish

    CSV Download.xlsm

  2. #2
    Forum Guru
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,445

    Re: VBA Query to Download a CSV file and to import in the sheet

    I have corrected few errors, but unlikely to help you further as the site requires password ad user name.
    You need to tick the box Microsoft HTML object Library in the tools-reference- before you run the code.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-30-2007
    Posts
    26

    Re: VBA Query to Download a CSV file and to import in the sheet

    Hi,

    Thanks for your reply.
    Need to mention to add the "Microsoft Internet Controls" Library in the tools-reference.
    As you mentioned it stuck at username and password.
    Forget to mention the website haven't use username and password.
    http://www.nseindia.com/live_market/dynaContent/live_watch/equities_stock_watch.htm"
    Any Insights

    Sathish

  4. #4
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: VBA Query to Download a CSV file and to import in the sheet

    Assuming you want to get the table as displayed on the screen, then use the code below.
    There's no way to just download the CSV from the document response as it is generated from a JSON object (as well as the table on the screen), so doing a simple webscrape won't work.
    You have to get and process the json object, which is exactly what the code below does.

    I advice you to paste this in an empty workbook.
    Only reference you need to set is to Microsoft Script Control 1.0

    Please Login or Register  to view this content.
    as you know, noone gets paid on this site, so I'd appreciate it if you'd press the * below if this helps.
    Enjoy!
    Last edited by JasperD; 07-04-2015 at 10:16 AM. Reason: ps - many thanks for Kyle123 on this forum to teach me how to do this
    Please click the * below if this helps

  5. #5
    Registered User
    Join Date
    04-30-2007
    Posts
    26

    Re: VBA Query to Download a CSV file and to import in the sheet

    Hi,

    It Works , Thanks a lot.

    I did (*) as you required.

    Sathish

  6. #6
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: VBA Query to Download a CSV file and to import in the sheet

    Glad to hear.
    Thanks for the rep.

    Please mark this thread as solved.

+ 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. Replies: 0
    Last Post: 10-31-2014, 12:27 AM
  2. Download .xls from web then import it in a sheet
    By Endorfyne in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-26-2013, 07:42 AM
  3. Import text file via Query
    By extrapulp in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-15-2011, 09:43 PM
  4. File import - select file and import sheet(1) from closed workbook
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2011, 03:15 AM
  5. macro to download file from FTP and import to excel
    By yannipr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-11-2008, 09:30 AM

Tags for this Thread

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