+ Reply to Thread
Results 1 to 6 of 6

Pulling source data from a list of URLs

  1. #1
    Registered User
    Join Date
    08-31-2010
    Location
    Connecticut
    MS-Off Ver
    Excel 2007
    Posts
    15

    Pulling source data from a list of URLs

    Hi All,
    I'm new to VBA and not sure if this is even an appropriate task for such.

    Per Excel 2007, I have a list of 25 urls in cells A1:A25. I'm looking for three pieces of information from the source code of each url. Place ID, Accept Policy, and Total.

    Each of the three pieces of data is in the same part of the source code in all 25 of the urls.

    Place ID is always located here after place_id and value in the source code:
    <input type="hidden" name="place_id" value="10450" />

    Accept Policy is always here in between the <p>:
    />Accept Policy</span></h3>
    <p>Always Accepted.
    </p>


    Summary is always here in between the <p>:
    <p class="summary_content_medium" style="color: #422; font-size: 90%; font-style: italic;">
    Total: 264,
    Summarized
    </p>


    Is it possible to extract these three data points from the source code of all 25 urls and place it in either a new sheet or the same sheet??

    Thanks in advance for your help and suggestions.
    Last edited by Bootkie2; 02-02-2012 at 10:44 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Pulling source data from a list of URLs

    Hello Bootkie2,

    It is very possible. You should post the page source as a text file in its entirety. This will ensure the data is extracted correctly.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    08-31-2010
    Location
    Connecticut
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Pulling source data from a list of URLs

    Hi Leith,
    Thanks for your help. Attached is a sample of the source code from one of the pages.

    Best
    -Bootkie
    Attached Files Attached Files

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Pulling source data from a list of URLs

    Hello Bootkie2,

    I downloaded the file. This is will be a big help. Are all the URLs in this same format?

  5. #5
    Registered User
    Join Date
    08-31-2010
    Location
    Connecticut
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Pulling source data from a list of URLs

    Hi Leith,
    Yes, all url source code is in the same format. The 3 desired data points are in the same place in each urls source. Thanks.

    -Bootkie

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Pulling source data from a list of URLs

    Hello Bootkie2,

    The file you provided contained only the first of the three parameters you are seeking. The macro was written and tested on the file source file you provided. The code worked for the first parameter but the other two are untested. The attached workbook contains the macro below.

    The macro checks the URL list on "Sheet1" starting with cell "A2" down to the last entry in column "A". Columns "B:D" hold the Place Id, Policy, and Summary. If an item is not found then the cell will be empty.
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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