npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@skypager/sheets-server

v1.4.2

Published

a google sheets api server

Downloads

12

Readme

Skypager Example App: Sheets Server

View Demo

This example uses the @skypager/helpers-server and @skypager/helpers-sheet to create a REST API that lets you discover some available google sheets, and get the data from those sheets as JSON.

In addition, this project shows a simple React webapp that lets you browse the different sheets you have available and view the data in them.

This server depends on having a google cloud project and credentials for that project in the form of a service account JSON file that you need to download.

This isn't included in the project, so you need to have one.

Requirements

  • You will need a service account JSON file that you download from Google Cloud for one of your projects.
  • This Google Cloud project needs to have enabled the google drive and google sheets APIs.
  • You will need to share some spreadsheets with the email address found in your service account client_email property

Installation and Usage

# install the dependencies
$ yarn 
# build the webapp
$ yarn build
# start the server
$ yarn start

Supplying Secrets

If you have the service account json, you can copy it into the secrets folder and we'll use that

# this should be .gitignored, .npmignored, .dockerignored
$ mkdir -p secrets
# this file name is important it needs to be serviceAccount.json
$ copy /path/to/downloaded/serviceAccount.json secrets/serviceAccount.json

Or using environment variables, you can supply config this way

# this is what the node google client uses by default, assumes the file exists on disk
$ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/serviceAccount.json
$ export GCLOUD_PROJECT=your-project-id-from-the-service-account

Or if you prefer via to pass this information via CLI args to the start command

$ yarn start --service-account=/path/to/serviceAccount.json --google-project=your-project-id-from-the-service-account

Deployment Example

When the service account file doesn't exist on disk, for example when deploying it to a cloud hosting provider such as now.sh, we can read the service account file via another environment variable.

*Now.sh Example

# on your local machine
$ export SERVICE_ACCOUNT_DATA=`cat /path/to/serviceAccount.json`
# set the secret to the content of the service account json
$ now secrets add service-account "$SERVICE_ACCOUNT_DATA"
# deploy to now using the secret as an environment variable
$ now -e SERVICE_ACCOUNT_DATA=@service-account 

REST API

  • GET /sheets - returns a list of sheet objects to work with
  • GET /sheets/:spreadsheetKey - returns all of the data for a given sheet object. the data will be keyed by worksheet, and contain an array of row objects whose keys are the column names of the sheet
  • GET /sheets/:spreadsheetKey/:worksheetKey - returns all of the data for a given worksheet. the data will be an array of row objects whose keys are the column names of the sheet

REST Client

const runtime = require('@skypager/web').use('./client.js')
const sheetsClient = runtime.client('app')
  • listSheets() returns an array of sheet objects
  • showFullSheet() returns all sheet data
  • showWorksheet() returns one worksheet from the google sheet as JSON