I am using IMPORTDATA() to pull a CSV from SurveyGizmo that should be updated in realtime when a user submits their survey. While the initial import of the CSV data loads fine, it never seems to update unless I delete the IMPORTDATA function and then paste it back in. I have tried to automate this by setting up a Google Apps Script and a trigger set to run the function on open and every 5 minutes. Here is the script I am using:
function myFunction() {
// clear the cells
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("realtime").getRange('A1:AP1000').clearContent();
//give the SurveyGizmo server a delay between requests
Utilities.sleep(12000);
// Pull data
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("realtime").getRange('A1').setValue('=QUERY(IMPORTDATA("https://address-to-csv&realtime=true"), "select * order by Col1 desc")');
}
The &realtime=true
is a SurveyGizmo call to refresh the CSV and get the latest data.
I'm not sure if this is an issue with Google, my script, or Survey Gizmo.
Any help or clarification is welcomed!