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

hooky-spreadsheets

v0.0.4

Published

Fixed Google Spreadsheet Data API for Node.js

Downloads

11

Readme

build status

NodeJS Google Spreadsheets Data API

A simple Node.js library to read data from a Google Spreadsheet.

Basic Example

var GoogleSpreadsheets = require("google-spreadsheets");

GoogleSpreadsheets({
	key: "<spreadsheet key>"
}, function(err, spreadsheet) {
	spreadsheet.worksheets[0].cells({
		range: "R1C1:R5C5"
	}, function(err, cells) {
		// Cells will contain a 2 dimensional array with all cell data in the
		// range requested.
	});
});

API

GoogleSpreadsheets = module.exports = function(opts, callback);

Loads a Spreadsheet from the API. opts may contain the following:

- `key`: *(required)* spreadsheet key
- `auth`: *(optional)* authentication key from Google ClientLogin

GoogleSpreadsheets.rows = function(opts, callback);

Loads a set of rows for a specific Spreadsheet from the API. Note that this call is direct, you must supply all auth, spreadsheet and worksheet information.

opts: - key: (required) spreadsheet key - worksheet: (required) worksheet id. Can be a numeric index (starting from 1), or the proper string identifier for a worksheet. - start: (optional) starting index for returned results - num: (optional) number of results to return - auth: (optional) authentication key from Google ClientLogin

GoogleSpreadsheets.cells = function(opts, callback);

Loads a group of cells for a specific Spreadsheet from the API. Note that this call is direct, you must supply all auth, spreadsheet and worksheet information.

opts: - key: (required) spreadsheet key - worksheet: (required) worksheet id. Can be a numeric index (starting from 1), or the proper string identifier for a worksheet. - range: (optional) A range (in the format of R1C1) of cells to retrieve. e.g R15C2:R37C8. Range is inclusive. - auth: (optional) authentication key from Google ClientLogin

Spreadsheet

Object returned from GoogleSpreadsheets() call. This object has the following properties: - title: title of Spreadsheet - updated: date Spreadsheet was last updated. - author: object containing name and email of author of Spreadsheet. - worksheets: Array of Worksheets contained in this spreadsheet.

Worksheet

Represents a single worksheet contained in a Spreadsheet. Obtain this via Spreadsheet.worksheets.

Worksheet has the following properties: - rowCount: number of rows in worksheet. - colCount: number of columns in worksheet. - Worksheet.rows(opts, cb): convenience method to call Spreadsheets.rows, just pass in start and num - will automatically pass spreadsheet key, worksheet id, and auth info (if applicable) - Worksheet.cols(opts, cb): convenience method to call Spreadsheets.cols, will automatically pass spreadsheet key, worksheet id, and auth info (if applicable). opts can contain range, etc.

A note on authentication

The Google Spreadsheets Data API reference and developers guide is a little ambiguous about how you access a "published" public Spreadsheet.

If you wish to work with a Google Spreadsheet without authenticating, not only must the Spreadsheet in question be visible to the web, but it must also have been explicitly published using the "Share" button in the top right corner of the Google Spreadsheets GUI.

Generally, you'll find alot of public spreadsheets may not have had this treatment, so your best bet is to just authenticate a Google account and access the API in that manner.

This library supports authenticated calls, when it is provided an authentication key from Google ClientLogin. The actualy authentication is not handled by this library. I would recommend the googleclientlogin

Authentication example (using googleclientlogin):

var GoogleClientLogin = require("googleclientlogin").GoogleClientLogin;

var googleAuth = new GoogleClientLogin({
  email: '<email>',
  password: '<password>',
  service: 'spreadsheets',
  accountType: GoogleClientLogin.accountTypes.google
});

googleAuth.on(GoogleClientLogin.events.login, function(){
	GoogleSpreadsheets({
		key: "<key>",
		auth: googleAuth.getAuthId()
	}, function(err, spreadsheet) {
		spreadsheet.worksheets[0].cells({
			range: "R1C1:R5C6"
		}, function(err, cells) {
			// bleh!
		});
	});
});

googleAuth.login();

TODO:

- Publish to npm (lol)
- Write some tests

Further possibilities for this library

- Edit functionality
- Sorting/filtering on row listing
- Filtering on cell listing.

Links

- <http://code.google.com/apis/spreadsheets/>
- <https://github.com/Ajnasz/GoogleClientLogin>