+ Reply to Thread
Results 1 to 8 of 8

exporting CSV from IE

  1. #1
    Registered User
    Join Date
    03-11-2016
    Location
    auckland, new zealand
    MS-Off Ver
    2013
    Posts
    3

    exporting CSV from IE

    Hi i am writing a code to simplify some tasks at work. there is a website that we visit regularly to get rainfall data from and its wastes allot of time filling out irrelevant data. i have written the code to open IE fill out requested data and generate tables. there is a button which opens a downloadable CSV file but for the life of me i cant get it working. my code looks like this so far

    Please Login or Register  to view this content.
    i have attached 2 files showing what my spreadsheet looks like at the moment and what the hirds website looks like (showing the CSV download link) Hirds.JPG spreadsheet.JPG

    if anyone could point me in the right direction that would be great.

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: exporting CSV from IE

    This doesn't answer your question directly, but, you know, you can pull that data right into Excel, without code, using Data->From Web, paste in the link 'https://hirds.niwa.co.nz/hirds_data/work/NZMG/6480256/2667674/2.1,0,0/DDF', click the four yellow arrows, click Import, point to starting cell and hit enter. Voila, all the data appears.

    When you need to update, just right click, Refresh.

    You can also record the web query and have the link built from the sheet data, if it changes.

    Please Login or Register  to view this content.
    David
    (*) Reputation points appreciated.

  3. #3
    Registered User
    Join Date
    03-11-2016
    Location
    auckland, new zealand
    MS-Off Ver
    2013
    Posts
    3

    Re: exporting CSV from IE

    Quote Originally Posted by Tinbendr View Post
    This doesn't answer your question directly, but, you know, you can pull that data right into Excel, without code, using Data->From Web, paste in the link 'https://hirds.niwa.co.nz/hirds_data/work/NZMG/6480256/2667674/2.1,0,0/DDF', click the four yellow arrows, click Import, point to starting cell and hit enter. Voila, all the data appears.

    When you need to update, just right click, Refresh.

    You can also record the web query and have the link built from the sheet data, if it changes.

    Please Login or Register  to view this content.


    thanks for the reply, but unfortunately the URL changes according to the address by adding the coordinates for the site to the URL as shown below in red

    https://hirds.niwa.co.nz/hirds_data/work/NZMG/6480256/2667674/2.1,0,0/DDF

    so unless I can pull the URL which my macro ends on into the workbook I cant use it your way.

  4. #4
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: exporting CSV from IE

    Well, yeah, That was the point of my response. All you have to do is build the url by passing the coordinates to it from Excel.

    Do you have the coordinates already? No, wait, you're passing the address... Hmmmm, hmmm... I know there is code available to calculate that. I'll work on it some more.

  5. #5
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: exporting CSV from IE

    What @Tinbendr suggest is better approach in my opinion. Anyway - it looks like the generated csv link is based on the name of the place you provide. In your example https://hirds.niwa.co.nz/data/work.csv
    I believe the blue part in the address is constant and you just need to adjust the red part after you have submitted.
    If you are pleased with a member's answer then use the Star icon to rate it.

  6. #6
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: exporting CSV from IE

    Here I changed a bit a code I used to download files back in time

    Please Login or Register  to view this content.
    Note that you that file generated is cached for some time and can be downloaded later on... I don't know how they solve naming conflicts. e.g. I was able to download data for location home generated on May 31st: https://hirds.niwa.co.nz/data/home.csv

    If the file does not exists, you get 404 error

  7. #7
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: exporting CSV from IE

    This answers your original question.
    Please Login or Register  to view this content.
    I've uploaded a file that has either solution.

    Sheet1 just d/ls the file.

    Sheet2 pulls the data in through a querytable to the sheet.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    03-11-2016
    Location
    auckland, new zealand
    MS-Off Ver
    2013
    Posts
    3

    Re: exporting CSV from IE

    Quote Originally Posted by Tinbendr View Post
    This answers your original question.
    Please Login or Register  to view this content.
    I've uploaded a file that has either solution.

    Sheet1 just d/ls the file.

    Sheet2 pulls the data in through a querytable to the sheet.
    Your first post got me going in the right direction (i'm just allot slower at coding), here you nailed it on the head! thanks mate! and thanks to everyone else who posted!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need help exporting to .txt with no tab
    By connelluk in forum Excel General
    Replies: 2
    Last Post: 07-16-2014, 03:45 AM
  2. Exporting to PDF
    By Keeper00 in forum Excel General
    Replies: 4
    Last Post: 04-23-2014, 11:31 AM
  3. Exporting as XML
    By meh2424 in forum Excel General
    Replies: 0
    Last Post: 02-09-2011, 05:01 PM
  4. Exporting to CSV
    By tezdread in forum Excel General
    Replies: 2
    Last Post: 06-10-2008, 05:10 PM
  5. exporting to ACT!
    By rmaxson1104 in forum Excel General
    Replies: 3
    Last Post: 06-24-2007, 07:52 PM
  6. Exporting
    By Mac Kearney in forum Excel General
    Replies: 1
    Last Post: 06-13-2006, 03:00 PM
  7. [SOLVED] exporting
    By njanja in forum Excel General
    Replies: 4
    Last Post: 04-11-2006, 07:23 PM

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