Hello,

The following spreadsheet 
<https://docs.google.com/spreadsheets/d/1ddmng6RKNaHcxX_s5jLXEKhd3lOXRuXmOPbXsWZRpE8/edit>
 
is not public, so the query.send() request will throw an error 403 in the 
browser console.
But this error is not reported in the callback response parameter.

With a small script (at the end of this post), I get the following console 
log :

*15:40:11.321  * 
> https://docs.google.com/a/revevol.eu/spreadsheets/d/1ddmng6RKNaHcxX_s5jLXEKhd3lOXRuXmOPbXsWZRpE8/gviz/tq?headers=2&range=A1:H&sheet=Sheet1&tqx=reqId:0
>   
> Failed to load resource: the server responded with a status of 403 (OK)
> *15:40:41.000  * test.html:21  Query DATA fetch: 30006.907ms
> *15:40:**41.000   *test.html:23  isError : true
> *15:40:**41.007*   test.html:24  hasWarning : false
> *15:40:**41.008*   test.html:25  getReasons : timeout
> *15:40:**41.008*   test.html:26  getMessage : Request timed out
> *15:40:**41.008*   test.html:27  getDetailedMessage :


The documentation 
<https://developers.google.com/chart/interactive/docs/reference#QueryResponse> 
says 
that getReasons() can return the followings code :
access_denied The user does not have permissions to access the data source.
invalid_query The specified query has a syntax error.
data_truncated One or more data rows that match the query selection were 
not returned due to output size limits. (warning).
timeout The query did not respond within the expected time.

Here, in this case, we should get an access_denied message.
It's either a problem in the google spreadsheet visualization 
implementation, either the mechanism behind *query.send()* in visualization.

As you can see in the* time-stamps*, the error 403 got thrown just after 
the query, but* query.send()* wait until the timeout (30 sec by default) to 
kick back.
This problem now impacts Awesome Table 
<https://sites.google.com/site/scriptsexamples/available-web-apps/awesome-tables>,
 
where it is necessary to get the correct reason of failure to inform the 
users.

Thank you for your time,

Jean-Rémi Delteil, Awesome Table Team


ps : here is the script :

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" 
src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization', 
'version':'1','packages':['controls']}]}"></script>
</head>
<body>
<script>
 google.setOnLoadCallback(sendQuery);
 function sendQuery(){
var queryString = 
'https://docs.google.com/spreadsheets/d/1ddmng6RKNaHcxX_s5jLXEKhd3lOXRuXmOPbXsWZRpE8/gviz/tq?headers=2&range=A1:H&sheet=Sheet1';
var query = new google.visualization.Query(queryString);
 // send the query
console.time('Query DATA fetch');
query.send(handleQueryResponse);
}
 function handleQueryResponse(response) {
console.timeEnd('Query DATA fetch');

console.log('isError : ' + response.isError());
console.log('hasWarning : ' + response.hasWarning());
console.log('getReasons : ' + response.getReasons());
console.log('getMessage : ' + response.getMessage());
console.log('getDetailedMessage : ' + response.getDetailedMessage());
}
 </script>
</body>
</html>


-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to