1

The following program uses a static JSON object as its data source. I just want to replace the JSON Object with an excel file. It seems to be possible using SheetJS library but I cannot find a working sample that uses a file link instead of a File upload mechanism. How to replace the JSON object with an excel file as the data source in the following code and pull data using SheetJS library?

 google.load('visualization', '1', {'packages':['table']});
    var SiteData = SiteInfo();
    var map;
    function initialize() 
    {  
  map = new google.maps.Map(document.getElementById('map_canvas'), {
    center: new google.maps.LatLng(55.7200,12.5700),
    zoom: 2,
    mapTypeControl: false,
    streetViewControl: false,
    mapTypeId: google.maps.MapTypeId.ROADMAP
      });
  for(m=0;m<SiteData.length;m++)
  {
    var image;
    if(SiteData[m].Connection=="Sitetype1")
    {
      image = "http://labs.google.com/ridefinder/images/mm_20_white.png";  
    }
    else if(SiteData[m].Connection=="sitetype2")
    {
      image = "http://labs.google.com/ridefinder/images/mm_20_black.png";
    }
    else
    {
        image = "http://labs.google.com/ridefinder/images/mm_20_purple.png";
    }
    setmarkers(map,SiteData[m].Latitude,SiteData[m].Longitude,image)
  }
}
function setmarkers(map,lat,lon,image)
{
    var latlon = new google.maps.LatLng(lat,lon);
    var marker = new google.maps.Marker({map:map,position:latlon,icon:image});
}
function Changesite(sc)
{   
    var mpls = Outage();
    for(var i=0,numSite = SiteData.length;i<numSite;i++)
    {
        if(SiteData[i].Sitecode==sc)
        {
            var data = new google.visualization.DataTable();
            data.addColumn('String', 'sitecode');
            data.addColumn('String', SiteData[i].Sitecode);
            data.addRows([
              ['Connection', SiteData[i].Connection],
              ['Bandwidth', SiteData[i].Bandwidth],
              ['Address', SiteData[i].Address],
              ['Country', SiteData[i].Country],
                 ]);
            var chart = new google.visualization.Table

(document.getElementById('chart'));
            var options = {
                    'title': SiteData[i].Sitecode+ ' ',
                             };
            chart.draw(data, options);
      }
    }
    }
function SiteInfo()
{
    var Siteinfo = 

[{"Connection":"Direct","Sitecode":"site1","Address":"Usa","Bandwidth":"6 

Mbps","Country":"USA","Latency":"44 ms","Latitude":44,"Longitude":34,"Item 

Type":"Item"}];
return Siteinfo;
}
function Outage()
{
    var Outage_Data= [{"COUNTRY":"USA ","SITECODE":"site1","Outage 

":"Issue1","DATE ":"4/1/2015"}];
    return Outage_Data;
}
Ram
  • 3,092
  • 10
  • 40
  • 56
C0d3ine
  • 379
  • 1
  • 3
  • 14
  • I reworded the question to make it more clear and requests for code samples is off topic in StackOverflow and add what you tried so far to your question and why it didn't work to make it more clear and specific rather thank asking for code samples. – Ram Jun 28 '15 at 20:37

0 Answers0