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 🙏

© 2026 – Pkg Stats / Ryan Hefner

read-spreadsheet

v3.0.0

Published

Reads a Google spreadsheet document by ID and returns the content

Readme

Description

Reads any sheet of a Google spreadsheet document and returns the content as JSON data. Only supports of Node.js environment.

API

The package represents a function with the following signature:

readSpreadsheet(spreadsheetId[, options]);

where:

  • spreadsheetId is the ID of a public Google spreadsheet document. You can get it from here: screenshot of spreadsheetId

  • options is an object which can contain:

    • isArray (boolean) - defines if content must be returned as JSON array (if true) or JSON object (if false); default: false;
    • gid (string) - sets an ID of a sheet from a spreadsheet document; the 1st sheet is read if not set; default: null. You can get it from here: screenshot of gid
    • isStream (boolean) - defines if content is represented as a readable stream with processed data (if true) or just stringified data (if false); default: false.

Usage

  1. Init a new project:

    npm init -y
  2. Install the package:

    npm i read-spreadsheet
  3. Create index.js file with the following content:

    const readSpreadsheet = require('read-spreadsheet');
       
    (async () => {
      // use your real spreadsheet ID!
      const content = await readSpreadsheet('u193j19jr-q9ew8ur98urq-32uruwr1h2k3h1k');
       
      // just to print it in the readable format
      console.log(JSON.stringify(content, null, 2));
    })();
  4. Run it:

    node ./index.js

FAQ

1. What if a spreadsheet document doesn't exist by the ID?

You will get an exception about wrong ID.

2. What if a spreadsheet document doesn't have public access?

You will get an exception about with the particular description.

3. What if some cells are merged vertically or horizontally?

You will get the same content as if none of the cells were merged. Instead of content for merged cells you will get an empty string.

4. What if a spreadsheet document contains some images or diagrams?

All graphic elements will be ignored and every such cell will contain just an empty string.

5. What if a spreadsheet sheet doesn't exist by "gid"?

You will get "null".

Testing

  1. Before running tests you need to define 2 environment variables in .env file:

    PUBLIC_SPREADSHEET_ID=?
    NON_PUBLIC_SPREADSHEET_ID=?
  2. To run tests:

    npm run test