Due to security concerns, I have to port all data from a fusion table to an excel file and still retain the fusion tables functionality which is used as a source for google maps. Now the issue i am facing is i came across alasql. I thought of using this to perform my task. But i am unable to find any documented examples of alasql which for excel and google maps using javascript only.
Can someone point me to an apt example that i can refer or any documentation on alasql with excel and gmaps. The below code is what i have to port from fusion table to excel file given by a link.
google.load('visualization', '1', {'packages':['table']});
function initialize() {
var map = new google.maps.Map(document.getElementById('map_canvas'), {
center: new google.maps.LatLng(55.7200,12.5700),
zoom: 2,
minZoom: 1,
maxZoom: 4,
mapTypeControl: false,
streetViewControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var layer = new google.maps.FusionTablesLayer({
query: {
select: 'Address',
from: '1234324235435435' // fusion table id here
},
suppressInfoWindows: true
});
layer.setMap(map);
google.maps.event.addListener(layer, 'click', function(e) {
var data = new google.visualization.DataTable();
data.addColumn('string', 'header1:');
data.addColumn('string', e.value1);
data.addRows([
['header2', e.value2],
['header3', e.value3],
['header4', e.value4],
['header5', e.value5],
['header6', e.value6],
['header7', e.value7],
['header8', e.value8],
['header9', e.value9],
['header10', e.value10],
]);
var chart = new google.visualization.Table(document.getElementById('chart'));
var options = {
'title': e.row['header'].value + ' ',
};
chart.draw(data, options);
});
}
function changeData(Sitecode) {
var whereClause = "";
if(Sitecode) {
whereClause = " WHERE 'Sitecode' = '" + Sitecode + "'"+"order by StartTime DESC limit 3";
}
var queryText = encodeURIComponent("SELECT 'Sitecode', 'IncidentID', 'IncidentReport', 'Resolved', 'StartTime' FROM 12345678" + whereClause);
var query = new google.visualization.Query('http://www.google.com/fusiontables/gvizdata?tq=' + queryText);
query.send(getData);
}
function getData(response) {
var table = new google.visualization.Table(document.getElementById('visualization'));
table.draw(response.getDataTable());
}
function UpgradeData(Sitecode) {
var whereClause = "";
if(Sitecode) {
whereClause = " WHERE 'Sitecode' = '" + Sitecode + "'";
}
var queryText = encodeURIComponent("SELECT 'Sitecode', 'curver' as Current_Version, 'upon' as Upgraded_On, 'upnext' as Next_Upgrade, 'upnotes' as Upgrade_Notes FROM 123456789" + whereClause);
var query = new google.visualization.Query('http://www.google.com/fusiontables/gvizdata?tq=' + queryText);
query.send(getdata);
}
function getdata(response) {
var table = new google.visualization.Table(document.getElementById('visualization1'));
table.draw(response.getDataTable());
}