ReferenceError: "Google" is not defined for Google Apps Script

I want my page to display a chart on google site, data source used is google spreadsheet. I am testing my code and it works well in JSFiddle. But when I copy my code to Google Apps Script it fails with ReferenceError: "Google" is undefined. I have no idea, I don't know what should be added using the google.visualization API, maybe Google Apps Script doesn't support the google.visualization API? I just add doGet () function, you can see my code:

 function doGet() {
        google.setOnLoadCallback(drawChart);

        function drawChart() {
                 var query = new google.visualization.Query(
                 'https://docs.google.com/a/valeo.com/spreadsheets/d/1wMku94s8LsbwPdoaVsJNL5IPdKVUdv8ZC_jgo2suV4Q/edit#gid=1287756093');
                 query.setQuery('select A, C');
                 query.send(handleQueryResponse);
        }

        function handleQueryResponse(response) {
            if (response.isError()) {
              alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
              return;
            }
            var data = response.getDataTable();
            var options = {
                           title: 'MS Project Licence From 2014',
                           hAxis: {title: 'Month',titleTextStyle: {color: 'red'}}
                          };
            var chart = new google.visualization.ColumnChart(document.getElementById('visualization'));
            chart.draw(data, options);
        }
  }

      

Evaluation for any offer

+3


source to share





All Articles