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

@memochou1993/google-sheets-i18n-syncer

v1.0.5

Published

A CLI tool to fetch and sync translations from Google Sheets

Downloads

25

Readme

google-sheets-i18n-syncer

A command-line tool for syncing translation data from Google Sheets.

Installation

Install the package as a project dependency:

npm i @memochou1993/google-sheets-i18n-syncer

After installation, you can use the CLI tool through npm scripts or via npx.

Prerequisites

  1. A Google Sheets spreadsheet with your translation data
  2. Google API credentials (JSON file)

Google Sheets Format

Your Google Sheets document should follow this format:

| Key | en | zh-TW | ja | |---------------|----------------|---------------|----------------| | greeting | Hello | 你好 | こんにちは | | goodbye | Goodbye | 再見 | さようなら | | thankyou | Thank you | 謝謝 | ありがとう | | welcome | Welcome | 歡迎 | ようこそ |

  • The first column must contain translation keys
  • Each additional column represents a language with its language code as the header (en, zh-TW, ja, etc.)
  • Column headers (language codes) will be used as filenames when generating translation files

Configuration

You can configure the tool in two ways:

Command-line Options

Pass options directly to the CLI commands (see examples in the Usage section).

Environment Variables

Create a .env file in your project root with the following variables:

# Required
I18N_SYNCER_SPREADSHEET_ID=your_spreadsheet_id_here

# Optional
I18N_SYNCER_SHEET_NAME=Translations
I18N_SYNCER_CREDENTIALS_PATH=./credentials.json
I18N_SYNCER_TRANSLATION_DIR=./translations
I18N_SYNCER_FORMAT=json

An example .env.example file is included in the package for reference.

Usage

Command Line

# Pull data from Google Sheets and save as language files
npx i18n-syncer pull --spreadsheet-id YOUR_SPREADSHEET_ID --credentials path/to/credentials.json

# Pull data from a specific sheet by name
npx i18n-syncer pull --spreadsheet-id YOUR_SPREADSHEET_ID --sheet-name "Sheet1" --credentials path/to/credentials.json

# Save language files to a custom directory
npx i18n-syncer pull --spreadsheet-id YOUR_SPREADSHEET_ID --translation-dir ./translations

# Push language files to Google Sheets
npx i18n-syncer push --spreadsheet-id YOUR_SPREADSHEET_ID --translation-dir ./translations

# Specify format (json or js)
npx i18n-syncer pull --spreadsheet-id YOUR_SPREADSHEET_ID --format js

# Specify main language for key ordering when pushing
npx i18n-syncer push --spreadsheet-id YOUR_SPREADSHEET_ID --format js --main-language en

Or add to your package.json scripts:

{
  "scripts": {
    "i18n:pull": "i18n-syncer pull",
    "i18n:push": "i18n-syncer push"
  }
}

Programmatic Usage

You can also use google-sheets-i18n-syncer programmatically in your Node.js applications:

import { I18nSyncer } from 'google-sheets-i18n-syncer';

const syncer = new I18nSyncer({
  spreadsheetId: 'YOUR_SPREADSHEET_ID',
  credentialsPath: './credentials.json',
  translationDir: './translations',
});

// Pull data from Google Sheets to language files
await syncer.pull();

// Or pull data from a specific sheet
await syncer.pull({
  sheetName: 'Sheet1',
  translationDir: './custom-dir',
});

// Push language files to Google Sheets
await syncer.push({
  sheetName: 'Sheet1',
});

// Push with specific main language for key ordering
await syncer.push({
  sheetName: 'Sheet1',
  mainLanguage: 'en',
});

API Documentation

I18nSyncer

The main class for syncing translation data with Google Sheets.

Constructor Options

  • spreadsheetId: Your Google Spreadsheet ID
  • credentialsPath: Path to your Google API credentials JSON file (default: './credentials.json')
  • translationDir: Directory where translation JSON files will be stored (default: './translations')

Methods

  • pull({ translationDir, sheetName, format }): Pulls data from Google Sheets and saves as language-specific files
  • push({ translationDir, sheetName, format, mainLanguage }): Pushes language files back to Google Sheets
    • mainLanguage: Specifies which language file to use as the base for key ordering (default: 'en')

GoogleSheetsClient

Lower-level class for interacting with the Google Sheets API.

License

MIT