Get data from a Google Spreadsheet using node.js
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
google-spreadsheet-data.js
package-lock.json
package.json

README.md

Google Spreadsheet Data

A node.js script to import data from Google Drive. Useful to use Google Spreadsheet data in static websites.

This script is based on the tutorial of Sprint Works, but was rewrited in simple and basic Vanilla JS.

This script connects to your spreadsheet, gets data and saves them in a yaml file to use with Jekyll.

Of course, you can edit the script to save the data in another format (json, xml...).

How to use it

Google Cloud Platform

  1. Go to Google Cloud Platform: https://console.developers.google.com/iam-admin
  2. Enable the Google Drive API in API and Services > Library > Google Drive.
  3. Create credentials (service account key in json type). You may have to create a service account or you could use one you've already created.
  4. Download the json file and place it in your project
  5. Open the file to discover email address of the service account:
    {
        ...
        "client_email": "XXXXX@atomic-climate-XXXXXX.iam.gserviceaccount.com",
        ...
    }

Google Spreadsheet

  • Share the spreadsheet you want to use with your IAM user email address

Node JS

  1. Move the package.json and google-spreadsheet-data.js files in your project
  2. Install dependencies:
    $ npm install
  3. Setup the google-spreadsheet-data.js script: