Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have list of all 10000 url's in excel sheet, is there easiest way i can make automation job to open each link and save the
Phone number and email
data in excel sheet.


http://scci.com.pk/member-detail.php?id=1
http://scci.com.pk/member-detail.php?id=2
http://scci.com.pk/member-detail.php?id=3
http://scci.com.pk/member-detail.php?id=4
http://scci.com.pk/member-detail.php?id=5
http://scci.com.pk/member-detail.php?id=6
http://scci.com.pk/member-detail.php?id=7
http://scci.com.pk/member-detail.php?id=8

any advice is highly appreciated.

What I have tried:

i have tried macro, chromium chrome extention but and chrome webscrape extention but all not worked for me . someone advice me it's possible by through vba within few minutes open all 10000 url and save all the data in excel sheet
Posted
Updated 29-Apr-18 22:14pm
Comments
Richard MacCutchan 30-Apr-18 3:57am    
You would need to take each element, open the url, read the response data, parse it to find the details, and save those in new cells in the worksheet. Not a trivial task.
Richard MacCutchan 30-Apr-18 3:59am    
I am amazed that these people are publishing their personal details on an open website in this way.
Richard Deeming 30-Apr-18 11:53am    
Make sure you have permission to access those files first:
Troy Hunt: Is Enumerating Resources on a Website "Hacking"?[^]

1 solution

For scci.com.pk domain, you can use this:

VB
Option Explicit

Sub CopySsciComData()
Dim srcWbk As Workbook
Dim lstWsh As Worksheet, srcWsh As Worksheet, dstWsh As Worksheet
Dim i As Integer, sAddress As String

On Error GoTo Err_CopySsciComData

'destination sheet
Set dstWsh = ThisWorkbook.Worksheets(2)
dstWsh.Range("A1") = "Contact Person"
dstWsh.Range("B1") = "Phone"
dstWsh.Range("C1") = "Mobile"
dstWsh.Range("D1") = "Email"
dstWsh.Range("A1:D1").Font.Bold = True

'sheet where links are stored
Set lstWsh = ThisWorkbook.Worksheets(1)
i = 2 'links started in second row
'loop through the collection of links
Do While lstWsh.Range("A" & i) <> ""
    'get address
    sAddress = lstWsh.Range("A" & i)
    'open worbook from link
    Set srcWbk = Workbooks.Open(Filename:=sAddress, ReadOnly:=True, AddToMru:=False)
    'get data
    Set srcWsh = srcWbk.Worksheets(1)
    srcWsh.Range("B5").Copy dstWsh.Range("A" & i)
    srcWsh.Range("B9").Copy dstWsh.Range("B" & i)
    srcWsh.Range("B10").Copy dstWsh.Range("C" & i)
    srcWsh.Range("B12").Copy dstWsh.Range("D" & i)
    Set srcWsh = Nothing
    srcWbk.Close SaveChanges:=False
    Set srcWbk = Nothing
    i = i + 1
Loop

Exit_CopySsciComData:
    'ignore errors
    On Error Resume Next
    If Not srcWbk Is Nothing Then srcWbk.Close SaveChanges:=False
    Set srcWbk = Nothing
    Set srcWsh = Nothing
    Set lstWsh = Nothing
    Set dstWsh = Nothing
    Exit Sub

Err_CopySsciComData:
    MsgBox Err.Description, vbExclamation, Err.Number
    Resume Exit_CopySsciComData
End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900