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:
var url = 'url to public CSV ...
Generating a direct download link, as described in this article seems to work fine with the =IMPORTDATA function.
To summarize, you take the SITE_ID string from the sharing link you have:
Using this, you can generate the direct download link for use with the =IMPORTDATA function:
Open the URL of the source data.
Press F12 to open Chrome Developer Tools
Press Control+Shift+P to open the Command Menu.
Reload the ...
You are right, the import functions updates their result at certain intervals.
From Change a spreadsheet's locale, time zone, recalculation, and language, a help article from the official documentation,
Note: External data functions recalculate at the following intervals:
ImportRange: 30 minutes
Across all the sheets you have created. I have run into this same issue before. this includes test sheets youve played with etc. anytime you have added those import functions and not removed them or left them in a state where they will not try to refresh on their own.
The file should be shared to anyone or to anyone with the link
If the file is "small enough" the URL to be used should have the form
If the file is big it could not be imported by using IMPORTDATA as Google Drive big files return a warning
Google Drive direct download for big files