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

@norviah/sheets

v4.2.0

Published

Convert Google Sheets into JSON.

Downloads

4

Readme

@norviah/sheets

Convert Google Spreadsheets into JSON. In order to use this package, you must enable the Google Sheets API for your Google account, which can be done here.

Click the Enable the Google Sheets API button and create a new application for a Desktop app. Once you have created an application, you'll be presented with your Client ID, Client Secret, and a button named Download Client Configuration. Click this button and download your configuration file as this is your credentials.json file and this file is used to authorize this application. Save this file in the sub-directory config under your project's root directory.

Installation

npm install @norviah/sheets

Usage

Your credentials.json file should be saved in the sub-directory config under your project's root directory, if wanted, you can save this file in another directory and point that directory to sheets during execution.

To use this module, you'll need the ID of a spreadsheet, which is the long random string in the URL. For example, if you want to convert the Animal Crossing: New Horizons Spreadsheet, you'll need the ID, which is 13d_LAJPlxMa_DubPTuirkIV4DERBMXbrWQsmSh8ReK4.

If sheets encounters an error while converting, which is most likely Google rate limiting the program, sheets will attempt to convert that tab again, up to three times. If an error still occurs for the third attempt, an error is thrown.

The usage for sheets looks like:

sheets({ /** spreadsheet */ }, { /** options */ })

To convert a spreadsheet using sheets, you must provide an object containing:

  • id string: The spreadsheet's ID.
  • include string[]: Optional, a list of tab names to only convert.
  • exclude string[]: Optional, a list of tab names to ignore and not convert.
  • dir string: Optional, sheets will save this spreadsheet's JSON file in this specific directory. If this value isn't provided, sheets will default to the dir directory in the options object, and if that value isn't provided, sheets will default to the sub-directory data in the project's root directory.

To convert multiple spreadsheets, you can provide an array of objects:

sheets([{ /** spreadsheet */ }, { /** spreadsheet */ }], { /** options */ })

Examples


// Node.js
const { sheets } = require('@norviah/sheets');

// Typescript
import { sheets } from '@norviah/sheets';

// To continue off of the example above, if you want to convert the AC: NH
// Spreadsheet, or any other spreadsheet, we'll do:
sheets({ id: '13d_LAJPlxMa_DubPTuirkIV4DERBMXbrWQsmSh8ReK4' });

// You can also convert multiple spreadsheets, pass in an array containing
// objects representing the IDs of each spreadsheet:
sheets({ id: '13d_LAJPlxMa_DubPTuirkIV4DERBMXbrWQsmSh8ReK4' }, { id:  '1BjqVeqIrfEezvyrWLUrwMjmK_UbY2LXkZ12mttamTtk' });

// To change the directory that converted JSON files will be stored, pass in
// a value for 'dir' in the 'options' object:
sheets({ id: '13d_LAJPlxMa_DubPTuirkIV4DERBMXbrWQsmSh8ReK4' }, { id:  '1BjqVeqIrfEezvyrWLUrwMjmK_UbY2LXkZ12mttamTtk' }, { dir: '/User/norviah/Desktop' });

// If wanted, you can provide a 'dir' value in each spreadsheet, and the JSON
// files for that specific spreadsheet, will be saved in that directory.
sheets({ id: '13d_LAJPlxMa_DubPTuirkIV4DERBMXbrWQsmSh8ReK4', dir: '/Users/norviah/Documents' }, { id:  '1BjqVeqIrfEezvyrWLUrwMjmK_UbY2LXkZ12mttamTtk' }, { dir: '/User/norviah/Desktop' });

// Note that if a directory does not exist, it will be created recursively.

For more documentation, visit the documentation directory.