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

@biva8710/gas-sheet-driver

v0.1.4

Published

Google Apps Script bridge driver for local development, enabling seamless execution with Vite and SQLite persistence.

Readme

@biva8710/gas-sheet-driver

@biva8710/gas-sheet-driver is a toolkit designed to modernize the Google Apps Script (GAS) development experience. By integrating with Vite, it allows you to fully run and test server-side logic, including Spreadsheet operations, in a local environment (Node.js + SQLite).

🇯🇵 日本語ドキュメント (Japanese Docs)

Features

  • Zero Config Vite Plugin: Automatically sets up a GAS execution environment (google.script.run emulation) on your local server just by adding the plugin.
  • 🔋 SpreadsheetApp on SQLite: Performs spreadsheet read/write operations against a local SQLite database. No need to worry about production API quotas during development.
  • 🔄 Universal Code: Server-side code (.js / .ts) runs on both GAS and local environments without any specific rewriting.

Installation

This package is intended for development environments only.

npm install -D @biva8710/gas-sheet-driver

Usage

1. Vite Configuration (vite.config.ts)

Importing the Vite plugin will automatically launch the backend GAS logic alongside your local server.

import { defineConfig } from 'vite';
import { gasPlugin } from '@biva8710/gas-sheet-driver/vite';

export default defineConfig({
  plugins: [
    gasPlugin({
      // Directory containing GAS code (or array of file paths)
      // default: uses rootDir from .clasp.json
      // include: ['./src'],

      // Local DB file path
      // default: local-dev.db
      // defaultSpreadsheet: 'local-dev.db',
      
      // Initial values injected into PropertiesService.getScriptProperties()
      // default: {}
      // mockProperties: { SSID: 'DEV_SHEET_ID' }
    })
  ]
});

2. Client-Side Implementation (GasBridge)

Use GasBridge.run instead of google.script.run. It supports Promise-based calls and syntax similar to native GAS global function calls.

import { GasBridge } from '@biva8710/gas-sheet-driver';

async function loadData() {
  try {
    // Seamlessly call server-side function getDayStatus(date)
    const data = await GasBridge.run.getDayStatus('2026/02/05'); 
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

3. Environment Variables & Mock Settings (.env support)

If you place a .env file in your project root, the plugin will automatically load it and inject it into PropertiesService.getScriptProperties().

# .env example
SSID=your_spreadsheet_id_for_dev
[email protected],[email protected]

If used with mockProperties in the Vite config, mockProperties values take precedence (overwrite).

gasPlugin({
  // Explicit mock settings (prioritized over .env)
  mockProperties: {
    DEBUG: 'true'
  }
})

4. Server-Side Implementation (GAS)

Write code just like normal GAS. The SQLite driver is automatically injected during local execution.

function getDayStatus(dateStr) {
  const ss = SpreadsheetApp.getActiveSpreadsheet();
  const sheet = ss.getSheetByName('2024_01');
  // ...
  return result;
}

Supported Features (Emulation)

Currently, a subset of the following features is supported:

  • SpreadsheetApp:
    • openById, getActiveSpreadsheet
    • getSheetByName, insertSheet, deleteSheet
    • getRange, getDataRange
    • getValues, setValues, clear
  • PropertiesService: getScriptProperties (Mock)
  • Utilities: formatDate (Mock)
  • Session: getActiveUser, getScriptTimeZone (Mock)
  • Logger: log (aliased to console.log)

TIPS: Customizing Mocks

If the default mocks are insufficient, or if you want to test specific behaviors, you can use the onContextReady hook to directly extend or overwrite GAS global objects.

gasPlugin({
  onContextReady: (gasContext) => {
    // Example: Overwrite Session.getActiveUser() behavior
    gasContext.Session = {
      getActiveUser: () => ({ 
        getEmail: () => '[email protected]' 
      })
    };
    
    // Example: Add a custom class not yet supported
    gasContext.MailApp = {
      sendEmail: (to, subject, body) => {
        console.log(`[MockMail] To: ${to}, Subject: ${subject}`);
      }
    };
  }
})

License

MIT