Home > Forum Home > Automating Data Analysis Tasks > Automating a web query login to download data | Share |
Forum Topic | Post Reply Login |
Automating A Web Query Login To Download Data | Rate this: (2.8/5 from 16 votes) |
I have a funamental earnings and valuation model spreadsheet that downloads stock data from a number of different websites via certain add-ins. One of the sites that it gets information from is investors.com, which requires a login before downloading stock information (not just price/volume/etc data, I get that easily from Yahoo). Problem is that you have to manually login through a web query each time, and this is the current instructions:
Thanks in advance for any help you can provide! | ||
Posted by kilo94 on |
Replies - Displaying 21 to 30 of 40 | Order Replies By: Most Recent | Chronological | Highest Rated |
Rate this: (3/5 from 1 vote) Sub Login_WebQuery_SessionID() Dim MyPost As String Dim SessionIDName As String Dim SessionIDValue As String Dim StartPos As Single Dim EndPos As Single Dim tempStr As String Const MyUrl As String = "http://www.bentekenergy.com/Benport/DisplayReportNews.aspx?LOC=1&ID=0&doc=BENTEK_EMF_NukeOutages.pdf" 'change URL here Const PostUser As String = "Login1$UserName=XXXXX" 'Change user name here Const PostPassword As String = "Login1$Password=XXXXX" 'Change password here SessionIDName = "XXXXX" 'change session ID name here 'tes 'Get the HTML of the URL Set IE = CreateObject("InternetExplorer.Application") IE.navigate MyUrl While IE.Busy DoEvents Wend x = IE.document.body.innerHTML IE.Quit 'Narrow down the HTML to extract the Session ID value StartPos = Application.WorksheetFunction.Find(SessionIDName, x) tempStr = Mid(x, StartPos, Len(x) - StartPos) StartPos = Application.WorksheetFunction.Find("value=", tempStr, 1) tempStr = Mid(tempStr, StartPos, Len(tempStr) - StartPos) EndPos = Application.WorksheetFunction.Find(" ", tempStr, 1) tempStr = Mid(tempStr, 7, EndPos - 7) tempStr = Replace(tempStr, """", "") SessionIDValue = tempStr 'Attach the Login and Password MyPost = PostUser & PostPassword 'Attach the required Session ID MyPost = MyPost & "&" & SessionIDName & "=" & SessionIDValue 'Run the Web Query With ActiveSheet.QueryTables.Add(Connection:= _ "URL;" & MyUrl, Destination:=Cells(1, 1)) .PostText = MyPost .BackgroundQuery = True .TablesOnlyFromHTML = True .Refresh BackgroundQuery:=False .SaveData = True End With End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub | |
Posted by vzny254 on |
Rate this: (3/5 from 1 vote) It shows me an error when I run it, it says: Websit "http:......... cannot be opened and data cannot be downloaded" What do you think might be wrong? Thanks for your help | |
Posted by Nick1234 on |
Rate this: (3/5 from 1 vote) https://my.secure.home1.ul.com/portal/page/portal/usa/Tools/MyProjects/Open%20Projects Have no clue what I need to do . I need to import data from this website, but the first step is how can I log in with excel. Please help. | |
Posted by Nick1234 on |
Rate this: (3/5 from 1 vote) [http://wwwa1.settrade.com/login.jsp?txtBrokerId=001] username and password name are txtLogin and txtPassword. Thanks a bunch Palm | |
Posted by palm on |
Rate this: (3/5 from 1 vote) Palm | |
Posted by palm on |
Rate this: (3/5 from 1 vote) I've got this excel file that sends a query to an IBM iSeries. I want to automate it but it asks for an authentication... Is there a way that i can put my username and password inside this macro so it logs in automatically? VBA Code:
| ||
Posted by BillyOcean on |
Rate this: (3/5 from 1 vote) StarQuery.RunTable "\\iseries\STARQUERY\Queries\***.sqx" SendKeys "username" it types the username in a cell of my excel sheet and not in the pop-up. I've tried delaying it and putting the code in different order but it does not work.. How do I get it to type my sendkeys info in the pop up? | |
Posted by BillyOcean on |
Rate this: (3/5 from 1 vote) (like in 'savecall .de/typo3/backend') It uses these strange variables userident and challenge... I get the typo3 error: Error: This host address ("www.mypage.de") and the referer host ("") mismatches! | |
Posted by AndemWue on |
Rate this: (3/5 from 1 vote) However, I need somehow to spoof the referer to login. I couldn't find a way to do that in a web query. Does anyone have an idea, please? | |
Posted by AndemWue on |
Rate this: (3/5 from 1 vote) Here is a free tool that i created that allows you to mark the data that you are inteterested on any web page and send it to excel. It also allows you to take any cell values from your spreadsheet and post them on any web service I am currently looking for excel users to help me try the Beta version and give feedback. If interested please email [email protected] Yoav | |
Posted by Yoavdembak on |
Back | Displaying page 3 of 5 | Next |
Find relevant Excel templates and add-ins for Automating a web query login to download data in the Excel Business Solutions Directory |