问题:目前我的代码可以完美地从一张表中提取数据,但我想要做的是从多个谷歌表中提取相同的数据。
我的尝试:我尝试了查询的不同变体,但是当我有多个表 IDS 时,表并没有显示出来。
工作查询:
var query = "SELECT 'City', 'Name', 'Gender', 'Full Address', 'Phone', 'Fax' " + 'FROM 117_2OT0fNljnKrx40V76XuoIFIm-IK6e5Zf3N2o';
尝试:(查询的 FROM 部分是变化的部分)
var query = "SELECT 'City', 'Name', 'Gender', 'Full Address', 'Phone', 'Fax' " + 'FROM "117_2OT0fNljnKrx40V76XuoIFIm-IK6e5Zf3N2o", "1npicUMaGTzjeDuvaDeq_F07V0Flmo1I3y3agGAc", "1BW-kAdtSNggLYOjGKeemSDRCj2eG0VF6R8wLX9w", "1yHhe0GkTBReuFdXelbAeqLzhknnNbs4JdAspndM", "1mfmx02FN7E3_G9J2BHv9FayK-UCz5BuFcxJ6j3A"';
整个谷歌可视化代码:
google.load('visualization', '1', { packages: ['table'] });
function drawTable() {
var query = "SELECT 'City', 'Name', 'Gender', 'Full Address', 'Phone', 'Fax' " + 'FROM 117_2OT0fNljnKrx40V76XuoIFIm-IK6e5Zf3N2o';
var state = document.getElementById('state').value;
if (state) { query += " WHERE 'State' = '" + state + "'"; }
var queryText = encodeURIComponent(query);
var gvizQuery = new google.visualization.Query( 'http://www.google.com/fusiontables/gvizdata?tq=' + queryText);
gvizQuery.send(function(response) {
var table = new google.visualization.Table( document.getElementById('visualization'));
table.draw(response.getDataTable(), { showRowNumber: false, sortAscending: true, sortColumn: 0 });
});
} google.setOnLoadCallback(drawTable);