0

I wish to download some data on a daily basis. I can get the data manually by loading the webpage web page with data and then there is a link near the top right hand corner called 'History Download'. This link opens an excel file with the data I require.

Using either C# or VBA is there anyway to automate this process and if so how?

Edit

Here is the code I currently have. It download a text file with all the html of the webpage although looking at the html it looks like the home page. Was hoping this link would download the data as an excel file. I originally save text.xlsx but it didn't like that so have save the file below as txt.

class Program
{
    static void Main(string[] args)
    {

        string path = "http://www.ishares.com/uk/institutional/en/products/251382/ishares-msci-world-minimum-volatility-ucits-etf/1393511975017.ajax?fileType=xls&fileName=iShares-MSCI-World-Minimum-Volatility-UCITS-ETF";
        string pathSave = @"C:\MyFolder\test.txt";

        WebClient wc = new WebClient();
        wc.DownloadFile(path,pathSave);
    }
}
mHelpMe
  • 6,336
  • 24
  • 75
  • 150
  • if the address is static and your question is just about downloading the file each day, you could do it easily with basic shell scripting (for instance using `wget` in Unix environment, or `Wget For Windows`) – Aserre May 28 '14 at 09:50
  • I believe the address is static. Sorry I do not know what you mean by wget? – mHelpMe May 28 '14 at 09:52
  • this is a comand line program in linux. There is an equivalent for windows [here](http://gnuwin32.sourceforge.net/packages/wget.htm). The basic usage is to launch a command prompt, and type `wget "www.my.url/my/document"` and it will download your file. You can use it in a script and execute that script every 24 hours, at startup, inside a program, etc ... – Aserre May 28 '14 at 09:55
  • I have the address of the webpage. When I click the link on the webpage "History Download" I do not see an address. So would wget only download the webpage? – mHelpMe May 28 '14 at 09:58
  • 1
    no. right click on "History Download">"Copy link address". This is the download url you are looking for. When you paste it in a browser, your download starts right away. It should look like this : http://www.ishares.com/uk/individual/en/products/251382/ishares-msci-world-minimum-volatility-ucits-etf/1393511975017.ajax?fileType=xls&fileName=iShares-MSCI-World-Minimum-Volatility-UCITS-ETF – Aserre May 28 '14 at 10:00
  • Oh I see, first time doing something like this. Can I use Wget in C# or VBA? – mHelpMe May 28 '14 at 10:05
  • 1
    Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/54609/discussion-between-ploutox-and-mhelpme). – Aserre May 28 '14 at 10:06

0 Answers0