Pull Google Sheets Data Into an Eleventy Site #1865
Replies: 3 comments
-
|
Awesome, do you want to write up a Quick Tip? See https://github.com/11ty/11ty-website/tree/master/docs/quicktips Would show up on https://www.11ty.dev/docs/quicktips/ |
Beta Was this translation helpful? Give feedback.
-
|
This repository is now using lodash style issue management for documentation requests. This means documentation issues will now be closed instead of leaving them open. View the documentation queue backlog here. Don’t forget to upvote the top comment with 👍! |
Beta Was this translation helpful? Give feedback.
-
|
Wrote a Quick Tip and created a pull request: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I figured out how to have a Google Sheet be used as a data source to populate an Eleventy rendered page. Once it is setup, you just need to edit the Google Sheet, run a bash script to download the Google Sheet JSON data, then run the Eleventy build.
entryobject before passing to the Eleventy data array to reduce the data complexity in the page template)data.my_datadata (njk file example from Skeleventy repo). This example assumes you have a Google Sheet with column header values ofLocation,Name,Description,URL. The JSON data presents the key values as all lowercase. You can uncomment the{{ myData | log }}in the page template if you want to see the myData object in the console output during the build process. You can also access the data.my_data object from the template if you want to use that method.)This example renders the Google Sheet data on the page as follows:
Beta Was this translation helpful? Give feedback.
All reactions