How to make a table with Google Sheets data using Google Charts API

346 views
Skip to first unread message

Matt Marshel

unread,
Apr 18, 2019, 4:38:54 AM4/18/19
to Google Visualization API
Hello,

I'm having trouble understanding how to connect my google sheets data to the Google Charts API to make a TABLE. The only example that Google shows of connecting data to make a table is in the miscellaneous examples section and I found it to be very confusing, so I'd like more explanation of how to implement this for myself. 


Google shows the example as the picture below, but I'd like tips on how to alter the 'template' code they give in the example to make it cleaner. I basically just want to get rid of the pages option (because i won't need pages for my data table), i don't want the 'number of rows to show' option; i just want a clean chart to post on a webpage that will update when new data is inputted in my google sheets document. 

tableex.jpeg

The picture below is how I want my data to look. (i made the table below in google sheets, but i can't use it for mobile because the google sheets chart isn't responsive)

tableex2.jpeg

Can anyone help with altering the code to get what I'm looking for in a table? Thank you much in advance! I've been struggling to figure this out and there aren't many resources for Google Charts API. 


Ray Thomas

unread,
Apr 18, 2019, 11:22:02 PM4/18/19
to Google Visualization API
An easier way to do what you want to do is to use the examples on https://developers.google.com/chart/interactive/docs/spreadsheets and https://developers.google.com/chart/interactive/docs/gallery/table

Using the examples you can see you have to load the table package by using 

google.charts.load('current', {'packages':['table']});

You can also then use the methods and options in the second of those pages. For example, the showRowNumber option is set to false as a default so that column won't show. It is also mobile-friendly, so the table is sortable on most devices.

Reply all
Reply to author
Forward
0 new messages