【发布时间】:2017-08-26 00:17:33
【问题描述】:
我正在尝试让 Google 表格应用程序脚本适用于我正在使用的 IMPORTXML。
A1
=importxml("http://www.nfl.com/liveupdate/scorestrip/ss.xml","//@q")
A2
=importxml("http://www.nfl.com/liveupdate/scorestrip/ss.xml","//@h")
数据来自A1:B16
根据我在网上找到的一个脚本让它自动刷新:
function getData() {
var queryString = Math.random();
var cellFunction1 = '=IMPORTXML("' + SpreadsheetApp.getActiveSheet().getRange('A1').getValue() + '?' + queryString + '","'+ SpreadsheetApp.getActiveSheet().getRange('A2').getValue() + '")';
SpreadsheetApp.getActiveSheet().getRange('C1').setValue(cellFunction1);
var cellFunction2 = '=IMPORTXML("' + SpreadsheetApp.getActiveSheet().getRange('A4').getValue() + '?' + queryString + '","'+ SpreadsheetApp.getActiveSheet().getRange('A5').getValue() + '")';
SpreadsheetApp.getActiveSheet().getRange('C2').setValue(cellFunction2);
}
我不知道我应该在该代码中放入/替换什么。如果有人可以帮助我解释我应该改变什么以使其在我的工作表中工作/提供一些示例来说明一个人的外观,那将是一个巨大的帮助。
我很感激
【问题讨论】: