我正在尝试使用UrlFetchApp查询带有gviz(Google Visualization)的电子表格,但到目前为止还没有结果。
你能帮我解决一下这段代码吗? (查询Url在浏览器中正常工作)
function queryTest() {
var onlyforscope = SpreadsheetApp.getActiveSpreadsheet();
var template = "https://docs.google.com/spreadsheets/d/%s/gviz/tq?gid=%s&tq=select C,E,K,M,N,O where C contains '%s'";
var query = Utilities.formatString(template, docId, sheetId, value);
var param = {
method : "get",
headers : {"Authorization": "Bearer " + ScriptApp.getOAuthToken()},
muteHttpExceptions:true,
};
var r = UrlFetchApp.fetch(query, param).getContentText();
// var j = JSON.parse(r);
Logger.log(r);
return;
}
提前致谢,Fausto
答案 0 :(得分:4)
var onlyforscope = DriveApp.getRootFolder();