我正在使用IMPORTDATA()从SurveyGizmo拉取CSV,当用户提交他们的调查时,CSV应该实时更新。虽然CSV数据的初始导入加载正常,但它似乎永远不会更新,除非我删除IMPORTDATA函数,然后将其粘贴回来。我试图通过设置一个Google Apps脚本和一个触发器集在打开时和每5分钟运行一次函数来实现自动化。下面是我使用的脚本:
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")');
}
&realtime=true
是一个SurveyGizmo调用,用于刷新CSV并获取最新数据。
我不确定这是否是Google、my script或Survey Gizmo的问题。
欢迎任何帮助或澄清!
发布于 2020-05-21 04:16:28
清除单元格后,添加SpreadsheetApp.flush()
以强制Google Apps Script将更改应用于电子表格。
此外,将setValue
替换为setFormula
(您甚至可以从公式中删除等号)
https://stackoverflow.com/questions/61915056
复制相似问题