🟩 Use gviz to get and query google sheet data


Guide on how to use the google visualization API to get and query "public" google sheet data

Use gviz to get and query google sheet data

Note: this approach has been knocking around for years, e.g. https://puravidaapps.com/spreadsheet.php, but I have never seen it "properly" explained like this...


Always like your tutorials :+1:


A very nice solution. From now on, we won't need to download the entire csv table :grin:

1 Like

thank you for providing a more detailed guide...
I now added a link to your guide on my page here https://puravidaapps.com/spreadsheet.php#select



(added to FAQ)

I especially like the HTML output option, providing a free table display without having to use JavaScript.


Why use this? Google should provide better security for private files.

{The security is fine if you write the script with the ID hard coded.

If you do not, and the user has access to and  CAN send other ID's of google sheets YOU OWN and have PRIVATE, then....

There are a lot of big IFs in this, but better to be safe than sorry. This example is also to show that it can be done using gviz, just that there are some caveats attached.

Another method is offered....}

[EDIT - the above actually relates to the other tutorial on gviz with private google sheets]

gviz is just another of several methods used to access public google sheets. There are no security issues here.


I saw on your website that there is a Google macro about this. So, how can I protect my files from being stolen? It is like Google is leaving a "peep hole" for others to see.

1 Like

You probably need to read up about google apps script:

Correct application of scripts and app blocks is needed.


Thanks @TIMAI2, This is a cool tutorial. I liked the html option, too. As always, it is clear and to the point.

Google provides data sheets, and how and what the user will use it is up to the user. Although they could make something like an access token.

1 Like

An access token is secure. Unless the access token link gets stolen.

If you don't link to your file anywhere and share it with everyone who has the link, nothing will be stolen.
Here, people learn to program and use the api provided by google. So maybe it's bad that the goggles provide such api? Everything is good for smart people ...


I have able to get like this image.But there is one problem it will show all data in Label-1 only. I want to separate it into 3 labels like.
Label-1 will show only Id,
Label-2 will show first_name
Label-3 will show last_name.

can anyone please help me to extract these into multiple labels.

Why do you have 4 accounts? You can only use one.


i have only one Naveen_Kumar2

and the photo is also not belongs to me. all other accounts are not own by me.

Ok, sorry my bad. I apologize for the inconvenience.

no problem

Here is one way ...