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-sheet-manager

v0.2.0

Published

Package that lets you simply use a Google Sheet to read and write content.

Downloads

3

Readme

GOOGLE SHEET MANAGER

This package is an abstraction of googleapis that lets you simply use a Google Sheet to read and write content.

You can create, read and write sub-sheets within a Google Sheet.

Requirements

  • Create a google sheet inside your Google drive
  • Create a service account and get its credentials (Guide)
  • Retrieve your sheet identifier within the url (https://docs.google.com/spreadsheets/d/<your identifier>/*)

How it works

Google-sheet-manager provides a class named SheetManager, you need to instanciate it with the same auth params you would provide to GoogleAuth (e.g: an array of scopes and the credentials JSON file of an account service) plus the Google Sheet identifier you want to interact with.

Example:

import { SheetManager } from  "google-sheet-manager";
import  credentials  from  "./google_credentials.json"  assert { type: "json" };
import { SHEET_ID } from  "../config/index.js";

const  scopes  = [
"https://www.googleapis.com/auth/drive",
"https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/spreadsheets",
];
const  authParams  = { scopes, credentials };
const  Manager  =  new  SheetManager(authParams, SHEET_ID);

With the following code, you are able to create, write and read any sub-sheets inside the sheet corresponding to SHEET_ID through Manager.

Methods

The SheetManager instance has access to the following methods:

  • writeToSheetWithCustomRange(sheetName, values, range, checkIfSheetExists?)

| Parameter| Type | DefaultValue | Description |--|--|--|--| | sheetName | string | None | The sub sheet name you are writting in | values| string[] | None | Each index of the array correspond to a cell | range| string | None | Example: "A2:C3" | checkIfSheetExists | boolean | true | Will check before inserting the values if the sheet exists, if not, it will create it first

Returns nothing.

  • readFromSheet(sheetName, range?)

| Parameter| Type | DefaultValue | Description |--|--|--|--| | sheetName | string | None | The sub sheet name you want to get content | range| string | "A2:Z1000"| Example: "A2:C3"

Returns an array of string arrays

Example of usage

NodeJS project with the following structure:

structure

./config/index.js config

./lib/sheet.js lib_sheet

./index.js index

It's a basic usage and of course the sheet name can be dynamic, so you can use others with the same instance of SheetManager.