+ Reply to Thread
Results 1 to 2 of 2

VBA to extract tables from multiple websites using cells in url

  1. #1
    Registered User
    Join Date
    10-01-2017
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    1

    VBA to extract tables from multiple websites using cells in url

    Hi,
    I'm trying to extract tables from websites (approximately 300) and to put them in different sheets. I have already found a macro I can use to use cells value in a sheet to complete the URLs of the website I want to take the tables from but it has the line .WebSelectionType = xlEntirePage. I tried to change it to .WebSelectionType = xlAllTables and other changes but I can't seem to be able to get any tables from the websites. Using the classic web query shows me the tables I want are availlible. The code I use is the following:
    Please Login or Register  to view this content.
    The value of the cells A2 and A3 of the sheet "data" are, per exemple, 493114 and 607297. The complete URL for the cell A2 would be https://baseballsavant.mlb.com/playe...er_type=batter . It would be very nice if someone could indicate me a way to make this code work for tables. Thank you for your time!

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

    Re: VBA to extract tables from multiple websites using cells in url

    They may appear to be tables. The tables however are generated by JavaScript. If you look at the source page, any word with the table is part of a JavaScript function. Your best bet to seek an API if the owner of the site has one. It might be probable to extract data using JSON parser, but this is going to massive loop code and not even sure if it works as VBA does not have a JSON parser.

+ 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. Extract word tables (multiple files) into excel using VBA
    By purple_milk in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 04-25-2024, 01:03 PM
  2. Extract word tables (multiple files) into one excel sheet using VBA
    By hguehring in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-17-2016, 08:54 AM
  3. Vba - retrieve value from multiple internet explorer websites to multiple cells
    By pexpex223 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-12-2014, 04:42 PM
  4. Loop Import HTML Tables, Extract 3 Cells from Table, Do Calculation on Cells
    By jhowland in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-04-2013, 01:07 AM
  5. [SOLVED] Lookup Multiple Tables, match, and extract relevant data
    By q8books in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-15-2013, 03:51 PM
  6. Capturing Data from multiple cells to multiple tables and cells on specific dates
    By zero_eclipse in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-27-2012, 08:38 AM
  7. Get data(Tables) from multiple websites
    By Primordium in forum Excel General
    Replies: 0
    Last Post: 07-30-2012, 10:31 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