I am having trouble getting the following code to work:
function doGet () {
var colChart = new Charts.newColumnChart()
.setDataSourceUrl('https://docs.google.com/a/1ins.us/spreadsheet/tq?&key=<mysecretkey>&tq=select%20N,%20S,%20count(A)%20Where%20A%20is%20not%20Null%20group%20by%20N,S')
.build();
var myapp = UiApp.createApplication().setTitle('Report for problems');
var mypanel = myapp.createVerticalPanel();
mypanel.add(colChart);
myapp.add(mypanel);
return myapp;
}
I get this error:
Method “newColumnChart” was invoked with [object Object] as “this”
value that can not be converted to type $Proxy715.
This occurs at the line containing setDataSourceUrl(). What is wrong there?
I’ve considered a number of possible problems, and have tried the following already:
- This is being used from a Google Apps for Business Account.
- I published the google spreadsheet.
-
I tested the url in chrome browser and got JSON wrapped in
google.visualization.Query.setResponse({ "version":"0.6", "status":"ok", "sig":"983199261", "table":{"cols":[{...... -
I tried to launch this from the GAS IDE by clicking on deploy as web app
Thank you.
Get rid of that new at the beginning. It’s
Charts.newColumnChart(), notnew Charts.newColumnChart().