I look on the internet to see how can I import bigquery data inside google spreadsheet. I found this appscript sample, but it doesn twork API are not at the same level, and I do not find how to query with API2 or API@beta1 in appscript.
function runQuery() {
var ss = SpreadsheetApp.getActive();
var range = ss.getRangeByName( query );
var query = range.getCell(1, 1).getValue();
//var results = bigquery.query(query);
var header = ss.getRangeByName( header );
header.clearContent();
var output = ss.getRangeByName( output );
output.clearContent();
for (var i = 0; i < results.fields.length; i++) {
var field = results.fields[i];
header.getCell(1, 1 + i).setValue(field.id);
}
for (var i = 0; i < results.rows.length; i++) {
var row = results.rows[i].f;
for (var j = 0; j < row.length; ++j) {
output.getCell(1 + i, 1 + j).setValue(row[j].v);
}
}
}
提前感谢您的想法,
GQ