[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create import-google-sheets-data.md #784

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

crockwave
Copy link
Contributor

You can use a Google Sheet as a data source to populate an Eleventy rendered page. My use case is a community edited Google Sheet, that can then be simply pulled into a static web site and rendered into a web page using Eleventy templates.

You can use a  Google Sheet as a data source to populate an Eleventy rendered page.  My use case is a community edited Google Sheet, that can then be simply pulled into a static web site and rendered into a web page using Eleventy templates.
@zachleat
Copy link
Member
zachleat commented Nov 29, 2020

I like this but can you use a markdown code block (the triple ```) instead of a remote image for the sample output?

Replaced remote image with markdown, to represent rendering results
@zachleat
Copy link
Member

Sorry for the super late response here. Went down the road of pulling this one in and unfortunately the Google Sheets API has been removed by Google 😱

image

Gonna have to close this one as stale—sorry!!

@zachleat zachleat closed this Feb 17, 2022
@ludvig-larsson
Copy link

@zachleat Open it again!

Sheets v4 API can be used, see here https://developers.google.com/sheets/api/guides/migration

Instead of publishing the sheet on the web, you just create a API KEY in Google Console and pass it to the URL. Like this: https://sheets.googleapis.com/v4/spreadsheets/[[your-spreadsheet-id]]/values/Sheet1?key=[your-api-key]

Just tested and got the following output:

{
  "range": "Sheet1!A1:Z1000",
  "majorDimension": "ROWS",
  "values": [
    [
      "name",
      "age"
    ],
    [
      "Fluffy",
      "2"
    ],
    [
      "Snugglepants",
      "5"
    ],
    [
      "Lord Featherbottom",
      "4"
    ],
    [
      "Pennywise",
      "9"
    ]
  ]
}

@zachleat zachleat reopened this Feb 18, 2022
@CanIGetaPR
Copy link
Contributor

@crockwave are you still available to update this PR using the new sheets API?

@crockwave
Copy link
Contributor Author

The web site I created this for is going out of service. I don't have a current application for this. I examined Google Sheets API V4 and was able to successfully run a sample GET on one of my sheets, but had to use OAuth rather than the general purpose API key that I generated. That GET returned JSON data.

https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get

As long as you can generate an updated JSON data file before compiling your site, you should be able to accomplish the use case of a community edited Google sheet that is the data source for an Eleventy compiled static page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants