NOTE: This method does not work anymore (as of late 2020)! See the FAQ for more details and fixes.
Here’s a snippet you can add to automatically refresh a cell that performs an IMPORTXML() lookup.
Key components - you need a blank cell somewhere in your Google Sheet that we can use for cache-busting.
For the example, let’s say it’s J24. Make sure J24 isn’t occupied by data. We’re going to write a random number to this field.
Next, create a cell that holds the URL you are fetching.
Important: format it like so: ="http://example.com/xmlfeed#"&J24
Note the trailing hash sign - that is just a throwaway parameter that we’ll use to refresh.
Now add the following in the script editor as a timed trigger.
Google Spreadsheets will automatically update whenever a cell is updated on the sheet ;) If you set a five minute trigger, that’s the frequency your IMPORTXML() cell will update.
NOTE: This method does not work anymore (as of late 2020)! See the FAQ for more details and fixes.