1

So I tried to get few things from a website into my Google spreadsheet and i want it to refresh every minute so I used this formula:

=IMPORTXML("http://www.myfxbook.com/community/outlook"&now(),"//a/@href")

The only thing I get is its "loading...". When I get rid of now() function, everything works fine but I want to get refresh every minute. How do I get this to refresh data every minute? Do I have to use script or maybe there is some other way to do this.

Thank you in advance.

Raptor
  • 53,206
  • 45
  • 230
  • 366
ignac
  • 113
  • 1
  • 7

1 Answers1

1

You could set up an installable trigger that runs an Apps Script function every minute. The Apps Script function could use UrlFetchApp.fetch() to get the data, then put it into the spreadsheet.

You could try using the setFormula() method of the Range class to re-enter the =importxml() formula into the cell and see if that works. In other words, the Apps Script script would be inserting the same exact formula into the cell every minute, and hopefully that would refresh the data. There is a SpreadsheetApp.flush() method that applies pending changes to the spreadsheet.

Alan Wells
  • 30,746
  • 15
  • 104
  • 152