WEBFLOW AND GOOGLE SHEETS.
Just about any data source is available online, whether it’s in a vanilla text file, SOAP API (not fun), a REST API, or even a simple Google Sheet.
Ben Englishby has provided us with amazing information, and some helpful steps to get started.
1. The Google Sheet must be published
2. The Google Sheet must be public
3. For the visualizations we used Chart.js and this script will need to be added in the head code of your Webflow project.
Cloneable Webflow version here
Now, if we get the sheet’s URL, we’ll want to note everything after the last slash, if you would like to create dynamic links and pages in the CMS:
This is the sheet identity and what we need for the GET request we send to Google. To make a GET request for JSON, we insert that string in the URL in another URL. The important piece is the feed.entry object array located in the console. This holds vital sheet data.
The Google Sheets API has preceded each of the column names with gsx$ (e.g. gsx$date). These are exactly how we will dissect the data from the object, using these uniquely generated names. So, knowing this, it’s time to insert the data into some isolated arrays and pass them into our chart function. Add an HTML embed box to your project and use the script from the cloneable version.
Hope this helps!