+ Reply to Thread
Results 1 to 9 of 9

Importing from online data source to a master spreadsheet

  1. #1
    Registered User
    Join Date
    05-30-2008
    Posts
    64

    Importing from online data source to a master spreadsheet

    I have a master workbook with different sheets with different economic statistics. At the moment, I would go to a government website, download the latest data, copy/paste the latest row into my master spreadsheet. I do this 20 times for different statistics and it is very inefficient. Does anyone know of some alternatives to this? I was thinking of making a loop to go through my master sheet and match the headings with the government sheets and then paste the last row, however ill have issues with matching the correct date.

    Does anyone have any tips to get me started on something like this?
    Thanks

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Importing from online data source to a master spreadsheet

    Have you tried the Import External Data method from the Data menu?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    05-30-2008
    Posts
    64

    Re: Importing from online data source to a master spreadsheet

    That only imports from a server or a database. The files that I have are just spreadsheets that i download every month.

  4. #4
    Registered User
    Join Date
    07-17-2010
    Location
    Kentucky
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Importing from online data source to a master spreadsheet

    Quote Originally Posted by ezzy85 View Post
    That only imports from a server or a database. The files that I have are just spreadsheets that i download every month.
    Any luck?

    I am using queries and they are more effective but some sites are discontinuing HTML eco releases - making queries inefficient...

  5. #5
    Registered User
    Join Date
    05-30-2008
    Posts
    64

    Re: Importing from online data source to a master spreadsheet

    unfortunately no. Do you have any sample queries that youre using? Maybe I could adapt them for my sites.

  6. #6
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Importing from online data source to a master spreadsheet

    Hi ezzy85;
    It's been several years since I used this. But I used to download federal interest rates into a sheet with this code. It doesn't work now. I get an error saying it couldn't download, but the code should still work.
    I remember that sURL had to start with "URL;" to let the query know that it was a URL
    Please Login or Register  to view this content.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  7. #7
    Registered User
    Join Date
    08-21-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Importing from online data source to a master spreadsheet

    Hi,
    This is my first post on this website.
    I have a big task at hand and I don't know how to write macros.

    I want to download quarterly financial data for 100s of companies from a particular website.
    Here is the link for data for 1 company.

    http://www.equitymaster.com/research...arterly-Result

    I want to download the table that appears on the webpage.
    I have codes of many companies with me .. like INFY in the above URL ..
    How do I automate this process?
    Please help..

  8. #8
    Registered User
    Join Date
    08-21-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Importing from online data source to a master spreadsheet

    Bump no response


    somebody please help me on this

  9. #9
    Registered User
    Join Date
    08-21-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Importing from online data source to a master spreadsheet

    Quote Originally Posted by Amar Thakkar View Post
    Bump no response


    somebody please help me on this


    Found this code somewhere .. not able to run it though

    ' Module : Module1
    ' DateTime :
    ' Author : chijanzen
    ' Purpose :
    '---------------------------------------------------------------------------------------
    'Option Explicit
    Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
    "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, _
    ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
    Sub Initialize()
    'link stored in A3
    Call DownloadFile(Range("A3"))
    End Sub
    Sub DownloadFile(sURL As String)
    Dim IE As New InternetExplorer
    Dim oDoc As New MSHTML.HTMLDocument
    Dim i As Integer
    IE.navigate sURL
    Do While IE.ReadyState <> READYSTATE_COMPLETE
    Application.StatusBar = "WEB sit connecting......"
    DoEvents
    Loop
    Set oDoc = IE.Document
    For i = 0 To oDoc.Links.Length
    On Error Resume Next
    ' Remove If for ALL downloads
    If UCase(Right(oDoc.Links(i).href, 3)) = "ZIP" Then
    'href:
    Call savefile(oDoc.Links(i).href)
    End If
    Next i
    Set oDoc = Nothing
    Set IE = Nothing
    Application.StatusBar = False
    End Sub
    Sub savefile(sURL As String)
    f = GetFileName(sURL)
    DoEvents
    Application.StatusBar = f & "Downloading..."
    returnValue = URLDownloadToFile(0, sURL, ThisWorkbook.Path & "\" & f, 0, 0)
    End Sub
    Function GetFileName(sText As String) As String
    Dim pos As Integer
    Do
    GetFileName = Mid(sText, pos + 1)
    pos = InStr(pos + 1, sText, "/")
    Loop While pos > 0
    End Function

+ 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