+ Reply to Thread
Results 1 to 5 of 5

Import csv file from web

  1. #1
    Registered User
    Join Date
    06-13-2014
    Posts
    23

    Import csv file from web

    Hello all,
    I have been tinkering with getting a .csv file to download by using VBA. The location of the information is here:

    http://finviz.com/screener.ashx?v=15...43,44,45,46,65

    This is a stock screener that allows me to set a few filters before downloading. I am focusing on relative performance.

    If you go to the link and scroll to the bottom of the page,you will notice that the there is actually more than one page of data. This means that using Get External Data/From Web only gives me some of the information, i.e. that which is on the visible table.

    In the lower right corner there is an "Export" button. This allows me to export the entirety of the screened information regardless of how many pages it is. I generally don't know how many pages there would be for a given screen. I have tried opening the export in a different tab or window so that I could direct the code to retrieve the information from that url. However, that url is the same as the one above and does not include a .csv extension.

    When you click on it in IE it gives you the option to Save or Open. If you choose Save, it saves as a .csv named finviz. If you choose Open it opens a .csv named finviz.

    I believe I can manipulate the data the way I want if I can get the code to retrieve the information. Inspecting the element for the Export button yields the code:

    <a class="tab-link" href="export.ashx?v=152&amp;f=sec_healthcare,sh_avgvol_o500,sh_opt_optionshort,sh_price_o10&amp;ft=4">export</a>

    I think this is the key to making this work, but I am not sure how to do this. Let me know if additional information is needed.

    Thanks in advance!

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Lightbulb Re: Import csv file from web


    Hi !

    Just notice Excel can open a csv file like a workbook xls* and also from an URL …

  3. #3
    Registered User
    Join Date
    06-13-2014
    Posts
    23

    Re: Import csv file from web

    Hi Marc,
    I am not sure I understand what you mean. doesn't a file need to be in .csv or .xls format in order for excel to open it? In this situation, there is no extension of any kind until it is opened or saved. if i could get to the point where it opened or saved, then I could probably get the information I need to the place i need it.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Lightbulb Re: Import csv file from web


    It's obvious : Excel can directly open an URL !

    But you had'nt test it !

  5. #5
    Registered User
    Join Date
    06-13-2014
    Posts
    23

    Re: Import csv file from web

    I found an answer! The code is posted here: http://investexcel.net/download-finviz-data/ Thanks to code author Samir!

+ 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: 05-28-2014, 02:45 AM
  2. [SOLVED] MACRO: Store name of selected file as string w/ import data file dialog box
    By AnnieMcken in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-13-2013, 02:13 PM
  3. [SOLVED] Macro - Master file to import data from another open file with variable file name
    By jdodz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-10-2012, 10:56 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. [SOLVED] How do I import text file, analyze data, export results, open next file
    By Geoffro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-06-2005, 04:06 PM

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