A small example site to demonstrate pulling data from Google Sheets in an Eleventy build
Example site: https://read-from-google-sheets.netlify.com/
This site is an example of using Eleventy's JavaScript Data Files which simplify sourcing content from remote data sources and making them available as objects to use globally across an Eleventy site.
The site is pulling content from a read-only Google Sheets feed at build time.
To get your own instance of this 11ty example project cloned and deploying to Netlify very quickly, just click the button below and follow the instructions.
Good question. Here's what it will do...
There are a couple of steps required to expose the content from your Google Sheet as a JSON API.
https://docs.google.com/spreadsheets/d/1CfI6XGm9OjjNKGr3kXRSKVLui_gkHZdadoOPIiNgE9s/edit#gid=0
https://docs.google.com/spreadsheets/d/{SHEET_ID}/edit#gid=0
https://spreadsheets.google.com/feeds/list/{SHEET_ID}/od6/public/values?alt=json
;/src/site/_data/prod/sheet.js
# install the dependencies
npm install
# External data sources can be stashed locally for API-less dev
npm run seed
# It will then be available locally for building with:
npm run start