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 🙏

© 2024 – Pkg Stats / Ryan Hefner

google-spreadsheet-v2v3-wrapper

v1.1.0

Published

Feature-incomplete wrapper of the google-spreadsheet package to map its new v3 interface to the old v2 interface for compatibility

Downloads

4

Readme

google-spreadsheet-v2v3-wrapper

By David Trapp

Feature-incomplete wrapper of the google-spreadsheet package to map its new v3 interface (which uses Google Sheets API v4) to the old v2 interface for compatibility - this is for people like me who discovered last-minute that there are some production apps out there that need to be updated to use Google Sheets API v4 (google-spreadsheet package v3) before the old API v3 (used by google-spreadsheet v2) is turned off on March 3rd, 2020.

To use this wrapper, just replace google-spreadsheet with google-spreadsheet-v2v3-wrapper and cross your fingers. Also, you may need to enable access to the "Google Sheets" API for your service account.

The wrapper supports callbacks (but also returns promises), and it takes care of emulating the previous behavior of column name normalization and 1-based indices.

There are a few limitations of course - if those apply to you, you will have to work around them in your code:

  • It needs node 8+. (There may be a way to transpile it using Babel to support older node.js versions in case you can't upgrade, but I didn't play around with that.)
  • The usage of getRows with orderBy, reverse or query is not supported and will throw!
  • setAuthToken is not supported and will throw. Only useServiceAccountAuth is supported.
  • Writing to fields with non-normalized field name will work, and reading is also possible using the non-normalized field name, but it won't be enumerable. Only the normalized field names are enumerable properties.
  • Some data like author and last update date is simply not returned in the new API. Attempts to access these fields will throw an error.
  • The IDs returned for sheets and rows are not compatible with those returned by the old API.
  • Formulae are using the A1 format instead of R1C1, and this wrapper does not convert the format!
  • Since the new API doesn't have a row-based access model with column headers and google-spreadsheet is emulating this behavior with a cached header row, this means that mixing row- and cell-based writes and reads, or concurrent writes and reads from several applications/instances on the same sheet, will mess up your state. You may fix it by calling worksheet.updateHeaderRow() (async).
  • makeFeedRequest is not supported and will throw.
  • v3, worksheet and spreadsheet are now also "reserved words" in rows and cannot be used as column headers.
  • getRows and addRow may return different instances of the same row. (However, worksheet instances are always unique.)
  • Errors are not normalized.

You can access the corresponding v3 object of all the classes using the v3 property.

Also, this was done in a pretty quick and dirty manner and not fully tested. It is provided as-is.

This project is under the MIT license.