Excel Automatic Download from http
Excel Automatic Download from http
Excel Automatic Download from http
Excel Automatic Download from http
Excel Automatic Download from http
Excel Automatic Download from http Excel Automatic Download from http Excel Automatic Download from http Excel Automatic Download from http Excel Automatic Download from http Excel Automatic Download from http Excel Automatic Download from http Excel Automatic Download from http
Excel Automatic Download from http Excel Automatic Download from http
Excel Automatic Download from http
Go Back  Xtreme Visual Basic Talk > > > Excel Automatic Download from http


Reply
 
Thread Tools Display Modes
  #1  
Old 05-26-2005, 04:41 PM
jjblake jjblake is offline
Newcomer
 
Join Date: May 2005
Posts: 7
Default Excel Automatic Download from http


I need to download Excel (csv) files from an http server automatically. So far, I can have IExplorer to display the file I want and to put it in the Temporary Internet Files folder as a csv file which is linked to the source. Once the file is in this directory is not accessible by VB or Excel. The code I'm using is:

Explorer = New SHDocVw.InternetExplorer
Explorer.Visible = True
Explorer.Navigate("http://ichart.finance.yahoo.com/table.csv?s=EXR&d=4&e=26&f=2005&g=d&a=7&b=16&c=2004&ignore=.csv
")

If someone knew how to get this done would be great, Also, is there a way to automate Excel to do this directly?
Reply With Quote
  #2  
Old 05-28-2005, 03:47 PM
George7a's Avatar
George7a George7a is offline
History: Jesus Is Risen
 
Join Date: Mar 2005
Location: Nazareth
Posts: 1,697
Default

You should save the html file on your pc

To save the webpage, you can do this:

Code:
webbrowser1.ExecWB OLECMDID_SAVEAS,OLECMDEXECOPT_PROMPTUSER

The WebBrowser Help file is on the Visual Basic CD, however it does not get installed when you install VB.

It is located on the CD at:

\TOOLS\UNSUPPRT\WEBBRWSR

Then open in it in Excel

I hope it helps
__________________
Thabet.Net
Reply With Quote
  #3  
Old 05-30-2005, 01:24 AM
Sigma Sigma is offline
Centurion
 
Join Date: May 2005
Location: Alberta, Canada
Posts: 110
Default

Can you clarify your questions for me? I don't understand why you can't import the .csv file type if it's already on your computer. I am currently writing a portfolio manager in excel and have modified some code that uses API calls to download specific files to specified locations on your harddrive from yahoo finance aswell. But since you already seem to be able to get them on your harddrive, you shouldn't need the lengthy API code.
Reply With Quote
  #4  
Old 05-30-2005, 05:44 PM
jjblake jjblake is offline
Newcomer
 
Join Date: May 2005
Posts: 7
Default

Quote:
Originally Posted by Sigma
Can you clarify your questions for me? I don't understand why you can't import the .csv file type if it's already on your computer. I am currently writing a portfolio manager in excel and have modified some code that uses API calls to download specific files to specified locations on your harddrive from yahoo finance aswell. But since you already seem to be able to get them on your harddrive, you shouldn't need the lengthy API code.

The file is stored in the Tempoarary Internet Files folder from where it seems to be inaccessible to Excel or VB. Furthermore, it seems that the csv file is a link -without a network conection I cannot open the file.

What is the code you are using?
Reply With Quote
  #5  
Old 05-30-2005, 06:11 PM
jjblake jjblake is offline
Newcomer
 
Join Date: May 2005
Posts: 7
Default Automatic Download of Excel files from Yahoo

Hi all,

I need to automatically download in an Excel file the historic prices of stock from yahoo. A link to one such file would be:

http://ichart.finance.yahoo.com/tabl...01&ignore=.csv

Any ideas on how I could Access, download and save these files on my computer. Thanks.
jjb
Reply With Quote
  #6  
Old 05-30-2005, 07:41 PM
piggybank1974's Avatar
piggybank1974 piggybank1974 is offline
Ultimate Contributor
 
Join Date: Mar 2002
Location: weston-super-mare(UK)
Posts: 1,795
Default

why not write your own file downloader using the Webrequest wrapper.

I'm not a great lover of .nets wrappers; well for communication anyways but this wrapper works well, and it's relatively easy to use it to download a file, or you could give it more functuality by placing it in a class and adding other methods etc.

the pig
Reply With Quote
  #7  
Old 05-31-2005, 12:04 AM
Sigma Sigma is offline
Centurion
 
Join Date: May 2005
Location: Alberta, Canada
Posts: 110
Default

I believe this is the code I modified http://xcelfiles.homestead.com/Excel01.html#anchor_27

It uses functions in the API that IExplorer uses from what I understand. It is fairly lengthy as are most API calls. Just out of curiousity, what type of program do you hope to develop? If it's similar to mine I wouldn't mind sharing some ideas; feel free to email me.

Hope this helps!

-Greg
Reply With Quote
  #8  
Old 05-31-2005, 05:45 AM
ericowi ericowi is offline
Newcomer
 
Join Date: May 2005
Posts: 6
Default

Imports system.net
.
.
.
Dim myClient As New WebClient
.
.
.
myClient.DownloadFile(File's URL)
.
.
.
Reply With Quote
  #9  
Old 05-31-2005, 08:29 AM
jjblake jjblake is offline
Newcomer
 
Join Date: May 2005
Posts: 7
Default

Quote:
Originally Posted by Sigma
I believe this is the code I modified http://xcelfiles.homestead.com/Excel01.html#anchor_27

It uses functions in the API that IExplorer uses from what I understand. It is fairly lengthy as are most API calls. Just out of curiousity, what type of program do you hope to develop? If it's similar to mine I wouldn't mind sharing some ideas; feel free to email me.

Hope this helps!

-Greg
I can get IExplorer to open a csv file in it, how do I save it afterwards?
Reply With Quote
  #10  
Old 05-31-2005, 08:32 AM
jjblake jjblake is offline
Newcomer
 
Join Date: May 2005
Posts: 7
Default

Quote:
Originally Posted by ericowi
Imports system.net
.
.
.
Dim myClient As New WebClient
.
.
.
myClient.DownloadFile(File's URL)
.
.
.
Thanks, now I have an additional problem. How do I authenticate (Login And Password.) I need to send this information in order to retreive the data. Any ideas? Thanks
Reply With Quote
  #11  
Old 05-31-2005, 08:41 AM
piggybank1974's Avatar
piggybank1974 piggybank1974 is offline
Ultimate Contributor
 
Join Date: Mar 2002
Location: weston-super-mare(UK)
Posts: 1,795
Default

this will be a three stp process, similar to POP3.

logoin th the server, then you will recieve a number, you will have to lookup that to find out what it means and reply to that, and so on and so forth, until you can download the desired file.

the pig..
Reply With Quote
  #12  
Old 05-31-2005, 09:11 AM
jjblake jjblake is offline
Newcomer
 
Join Date: May 2005
Posts: 7
Default

Could you be a little bit more specific?

I was thinking that I could maybe use WebClien.Credentials -but I am not sure how- given that I am already using the WebClient. Do you think this could work and if so how could I configure it?

Is there a way in which I could login using IExplorer and then somehow use the cookies gathered from this action in my VB program?

Thanks.
Reply With Quote
  #13  
Old 06-01-2005, 11:46 AM
Sigma Sigma is offline
Centurion
 
Join Date: May 2005
Location: Alberta, Canada
Posts: 110
Default

Quote:
Originally Posted by ericowi
Imports system.net
.
.
.
Dim myClient As New WebClient
.
.
.
myClient.DownloadFile(File's URL)
.
.
.

lol, you can't be serious that this works just as well as that insanely long API code I run. I'll hafta try this when I get home . As for the authentication thing, I really would like to know as well and have wasted quite a few hours up to this point trying to find a code in any language that can accomplish this. Please help!

Last edited by Sigma; 06-01-2005 at 12:37 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Excel Automatic Download from http
Excel Automatic Download from http
Excel Automatic Download from http Excel Automatic Download from http
Excel Automatic Download from http
Excel Automatic Download from http
Excel Automatic Download from http Excel Automatic Download from http Excel Automatic Download from http Excel Automatic Download from http Excel Automatic Download from http Excel Automatic Download from http Excel Automatic Download from http
Excel Automatic Download from http
Excel Automatic Download from http
 
Excel Automatic Download from http
Excel Automatic Download from http
 
-->