URL format for extracting data from Google Sheets

115 views
Skip to first unread message

Laurie Bennett

unread,
Apr 10, 2024, 7:10:39 PMApr 10
to Google Visualization API
I'm using Google Charts to create pie charts on my Wordpress site. These charts display if I hard-code the data, but I'm trying to use a query of a public Google Sheet. It's not working, and the problem appears to be in this section.

        // Callback to draw the chart
function drawChart() {
  var query = new google.visualization.Query("[Google Sheet URL]/gviz/tq?tq=[ENCODED QUERY]");
  query.send(handleQueryResponse);
}

Bracketed info is replaced by the real values (minus the brackets). The query has been encoded using the tool on this page: https://developers.google.com/chart/interactive/docs/querylanguage.

I use double quotes around the URL because the query contains a where clause with single quotes.


Any thoughts why this isn't working?

Laurie Bennett

unread,
Apr 16, 2024, 9:10:31 AMApr 16
to Google Visualization API
On exploration, it looks like the URL structure I'm using works. But something is preventing it from loading at Wordpress. Do you know which (common) plugins might be blocking the retrieval of data from the Google Sheets server?
Reply all
Reply to author
Forward
0 new messages