I am trying to create a google column chart from a google spreadsheet but keep getting blank

Viewed 27

My code snip keeps giving me blank, not sure why. I included my spreadsheet link in the code which is shared with anyone with link, it's a range containing data of dates and stock price close values. if you can spot and fix the issue it will be great as I plan to reuse this code snip it for line charts too. Please indicate what I am missing anything. " I know its noob question but I am new to coding.

 <!DOCTYPE html>
<html>
  <head>
  <title>Bar Chart with Dropdown JSON</title>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    
    
  </head>
  <body>

    <div id="div_chart"></div>
   
    
    <script type="text/javascript">
      google.charts.load("current", {packages:["corechart"]});
      google.charts.setOnLoadCallback(drawChart);
      
       
     
function drawChart() {

      var queryString = encodeURIComponent('SELECT A3:B25');
      var query = new google.visualization.Query(
          'https://docs.google.com/spreadsheets/d/1DOq0dwcWN09MA-ScFbUF-Abl0OKzfqthx_ixpxIq7P0/edit#gid=59852832'+ queryString);
      query.send(handleSampleDataQueryResponse);
    }

    function handleSampleDataQueryResponse(response) {
      if (response.isError()) {
        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
        return;
      }

      var data = response.getDataTable();
      var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
      chart.draw(data, { height: 400 });
    }
    </script>
  </body>`enter code here`
</html>
0 Answers
Related