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

sheettojson-api

v1.0.0

Published

Official Node.js SDK for the SheetToJSON RapidAPI. Turn Google Sheets into a secure CRUD backend.

Readme

sheettojson-api

Official Node.js SDK for the SheetToJSON RapidAPI. Turn any Google Spreadsheet into a secure, blazing-fast REST API with built-in S3 caching and smart querying. No complex OAuth setup required.

Installation

npm install sheettojson-api

Prerequisites

  1. Get your API key from RapidAPI.
  2. Share your target Google Spreadsheet with Editor rights to the service account email provided on the RapidAPI documentation page.

Initialization

Import the SDK and initialize it with your RapidAPI key.

import { SheetToJSON } from 'sheettojson-api';

const db = new SheetToJSON('YOUR_RAPIDAPI_KEY');
const SPREADSHEET_ID = '1BxiMVs0XRA5nFMdkvBdBZjgmZ_xyz123'; // Found in your Google Sheet URL
const SHEET_NAME = 'Products'; // The exact name of the tab

Usage Examples

1. Register your Spreadsheet

You must link a spreadsheet to your RapidAPI account once before using the CRUD operations.

async function registerSheet() {
    try {
        const response = await db.register(SPREADSHEET_ID);
        console.log(response.message);
    } catch (error) {
        console.error(error.message);
    }
}

2. Read and Filter Data (GET)

Retrieve rows with built-in pagination, sorting, and advanced filtering. This endpoint is served from a high-speed cache.

async function fetchData() {
    try {
        const response = await db.get(SPREADSHEET_ID, SHEET_NAME, {
            limit: 10,           // Max 1000, default 100
            page: 1,             
            price: 'gt:50',      // Advanced filter: Price Greater Than 50
            category: 'lk:tech', // Advanced filter: Category Contains (Like) "tech"
            sort: 'price:desc'   // Sort by price descending
        });

        console.log(`Found ${response.meta.returned_rows} rows.`);
        console.log(response.data);
    } catch (error) {
        console.error(error.message);
    }
}

3. Insert Data (POST)

Add new rows to the bottom of your sheet. You can pass a single object or an array for batch insertion.

async function insertData() {
    try {
        const newProducts = [
            { id: 105, name: "Wireless Mouse", price: 25.99, stock: 150 },
            { id: 106, name: "Mechanical Keyboard", price: 89.00, stock: 40 }
        ];

        const response = await db.insert(SPREADSHEET_ID, SHEET_NAME, newProducts);
        console.log(response.message); // "2 row(s) successfully inserted."
    } catch (error) {
        console.error(error.message);
    }
}

4. Update Data (PATCH)

Update specific fields of an existing row. Provide the column name (lookupKey) and the value (lookupValue) to find the exact row to update.

async function updateData() {
    try {
        // Find the row where 'id' equals 105, and update its price and stock
        const response = await db.update(SPREADSHEET_ID, SHEET_NAME, 'id', 105, {
            price: 19.99,
            stock: 140
        });

        console.log(response.updated_data);
    } catch (error) {
        console.error(error.message);
    }
}

5. Delete Data (DELETE)

Delete a row from your sheet using the lookup system.

async function deleteData() {
    try {
        // Find and delete the row where 'id' equals 105
        const response = await db.delete(SPREADSHEET_ID, SHEET_NAME, 'id', 105);
        console.log(response.message);
    } catch (error) {
        console.error(error.message);
    }
}

TypeScript Support

This package is written with full TypeScript support. You can pass your own interfaces to the generic methods for perfect autocompletion (IntelliSense) in your IDE.

import { SheetToJSON } from 'sheettojson-api';

const db = new SheetToJSON('YOUR_RAPIDAPI_KEY');

// Define your sheet structure
interface Product {
    id: number;
    name: string;
    price: number;
    stock: number;
}

async function getProducts() {
    // Pass the interface to the get method
    const response = await db.get<Product>(SPREADSHEET_ID, SHEET_NAME);
    
    response.data.forEach(product => {
        // Fully typed!
        console.log(product.name, product.price); 
    });
}

License

MIT