4

We have a Google Spreadsheet that pulls data from an external source via an IMPORTDATA() function and then a Google Apps Script that is on a timed trigger that performs other things with the imported data.

It's failed a few times which makes us wonder whether the IMPORTDATA() function is refreshing the data if the sheet is not manually opened? Or in other words when the Apps Script fires from it's timed trigger does the sheet automatically refresh it's formulas?

1 Answer 1

6

The IMPORTDATA() function has a latency of approximately 1 hour, as explained in this post on the Google Product Forum.

You mentioned the fact that a script was being fired by a time based Google Apps Script trigger. I was thinking, if you're using a script in the first place, why not fetch the CSV file as well, like so:

Code

var url = 'url to public CSV file';
var text = UrlFetchApp.fetch(url).getContentText();
var csv = Utilities.parseCsv(text);

The var csv is turned into a 2d-array and can be used like any other array. This way, you always have the latest CSV file.

References

1
  • @Jamonroad I am using following IMPORTDATA function =IMPORTDATA("google.com/finance/…) Can you pls help me how to write Script or a sample code in which I can replace the data I need. Thanks. Commented Mar 12, 2018 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.