Hi 

You have to perfom a Google OAuth authentication 
<https://developers.google.com/identity/choose-auth>, then add the token 
returned to the request URL in an *access_token *parameter.

So with your code:

var query = new google.visualization.Query(
      
'https://docs.google.com/spreadsheets/d/yourapiyourapi/tq?gid=yourgidyourgid&headers=1&tq='
 
+ queryString + '&access_token='+ accessToken);
);

query.send(handleQueryResponse);


The OAuth needs to be done with the following scope:
"https://spreadsheets.google.com/feeds";

And the authenticated user needs to have read access to the spreadsheet, or 
it will fail.

On Monday, 22 October 2018 19:26:43 UTC+2, Heath Heath wrote:
>
> Hi, 
>
> I have created a timeline chart using google visualization that pulls data 
> from a private google sheet.
> I'd like to share this timeline with other people in my organization. When 
> me or anyone tries to access it now when the sheet is set to private I get 
> an access_denied error. 
>
> My data is connected like so:
>
>   var query = new google.visualization.Query('
> https://docs.google.com/spreadsheets/d/yourapiyourapi/tq?gid=yourgidyourgid&headers=1&tq='
>  
> + queryString);
>       query.send(handleQueryResponse);
>
> I get an error saying:
>
> Error in query: ACCESS_DENIED This spreadsheet is not publicly viewable 
> and requires an OAuth credential.  For more information, see 
> https://support.google.com/docs/?p=gviz_tq_auth
>
> I've read the documentation but everything on stackoverflow is from 2011 
> and is outdated. 
>
> The examples here are not clear:
>
> https://developers.google.com/google-ads/scripts/docs/examples/oauth20-library
>  
>
>
> Thank you
>
>
>
>

-- 
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 google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/d4946647-b42d-471a-b0a5-296bb41b751e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to