How to use Google Spreadsheet as data source

Posted on April 11, 2018 in
2 min read

Do you know you can publish any Google Spreadsheet in a CSV format for convenient usage in other environments, let's say, in a D3.js script?

I know, it's not the revelation of the year. Blame to me since I've discovered it only recently.

Google Spreadsheet can be an effective and accessible tool for initial data cleaning, exploration and visualization. Indeed, it can be used also for powerful data wrangling thanks to its set of formulas and computation ability.

It can be used as a single source of truth (because the export gets updated automatically if you modify something in the sheet) for an interactive visualization making it an interesting option for every DataViz practitioners.

The following is a very basic Proof-Of-Concept of what I said. The spreadsheet can be published as a whole as well as a partial set of sheets. You can grab the URL according to the format you need, for instance, here the HTML format for easy embedding:

And here the live sketch with a little barchart using the spreadsheet as data source:

See the Pen TestLoadGSPXwithD3 by Fabio Franchino (@abusedmedia) on CodePen.

I'll post more use-case with this combination.