1

Using importhtml, I always access tomorrows updated data from a website which finishes the webpage address with tomorrows date. Is there a way of automatically updating that part of the address each day so that it will continue to import tomorrows data?

e.g. : https://www.poisonfoot.com/30-12-2020/

=importhtml("https://www.poisonfoot.com/30-12-2020/","table",0)

2
  • Welcome to Web Applications. Yes you can, by using "TODAY()+1" and TEXT function fo convert this to the required date format. If you need further help, please add a brief description of your search/research efforts as is suggested in How to Ask.
    – Rubén
    Dec 30 '20 at 0:41
  • The page on the website for tomorrow will now have changed from =importhtml("poisonfoot.com/30-12-2020/","table",0) to =importhtml("poisonfoot.com/31-12-2020/","table",0) because the page i require whis always tomorrows so +24 hours. This page address changes by a day every 24 hours. Id like to know if this can be created automatically. I can use the today()+1 function however this doesn't interact within the formula because of the speech marks? 2importhtml("poisonfoot.com/30-12-2020"
    – MR H
    Dec 30 '20 at 0:56
1

I think this is what @Rubén was getting at. This formula will automatically change to reflect the current date:

="https://www.poisonfoot.com/"&day(TODAY())&"-"&month(TODAY())&"-"&year(TODAY())&"/"

Value = https://www.poisonfoot.com/31-12-2020/


Snapshot


Leading zeros

The values of day, month and year in the web address are taken from values; the result is that leading zeros that might appear in TODAY() are lost when combined in the web address.

The alternative is to convert the values to text and format them. In this solution, I used TEXT() and the format of dd/mm/yyyy (forcing leading zeros).

="https://www.poisonfoot.com/"&left(text(today(),"dd/mm/yyyy"),2)&"-"&mid(text(today(),"dd/mm/yyyy"),4,2)&"-"&mid(text(today(),"dd/mm/yyyy"),7,4)&"/"

Value = https://www.poisonfoot.com/04-01-2021/


Alternate with leading zeros

2
  • Thats great thanks for your help. This creates the correct web address however ive noticed that actually the we address date the way it is published is poisonfoot.com/02-01-2021 and currently that formula presents the address as poisonfoot.com/2-1-2021 is there an easy solution to ensure that 2 units are used for the day and months ?
    – MR H
    Jan 1 '21 at 9:51
  • @MRH Easy sure. You need to render the values as text rather than numbers. Refer my addendum to this answer. BTW, if this answer was helpful, you might consider "accepting" it.
    – Tedinoz
    Jan 3 '21 at 23:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.