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

@joyining/gsheet-helper

v1.0.16

Published

gsheet-helper generates multiple json files based on your Google sheets. It helps you to transfer data into json format.

Downloads

3

Readme

gsheet-helper

gsheet-helper generates multiple json files based on your Google sheets. It helps you to transfer data into json format.

Installation

npm i @joyining/gsheet-helper --save-dev

Usage from command line

Create a gsheet.config.js under root folder, following the below example:

module.exports = {
  docID: '',
  credentialsPath: '',
  sheets: [
    {
      sheetID: '',
      files: [
        {
          prefix: '',
          keyColumns: [],
          valueColumns: [],
          filePath: ''
        },
        {
          prefix: '',
          keyColumns: [],
          valueColumns: [],
          filePath: ''
        },
      ],
    },
  ],
}

| Key | Description | | ---------------- | -------- | | docID | required, Google sheet document ID. | | credentialsPath | optional, the path for credential to access the Google sheet. It takes credentials.json under root folder as the default credential path. | | sheets | required, specify the target sheets. | | sheetID | required, Google sheet sheet ID. | | files | required, specify expected results. | | prefix | optional, the prefix before key string, default is empty string. | | keyColumns | required, the columns to concatenate key. | | valueColumns | optional, the columns to concatenate value, default is empty string. | | filePath | required, the path and file name for the generated file. |

Custom a script in package.json:

"scripts": {
  "sync": "gsheet-helper"
},

gsheet-helper will take gsheet.config.js under root folder as the default config. If your config is not named as gsheet.config.js, please specify the file name in the command, for example:

"scripts": {
  "sync": "gsheet-helper my.gsheet.config.js"
},

Run script and check if json files are generated.

npm run sync

Examples

Input

You have a 3-column Google sheet containing translations for some words: | en | zh | ja | | -------- | ------- | -------------- | | Engineer | 工程師 | エンジニア | | Homepage | 首頁 | ホームページ | | Frontend | 前端 | フロントエンド | | Backend | 後端 | バックエンド |

// gsheet.config.js
module.exports = {
  docID: 'XXXXX',
  credentialsPath: 'myCredential.json',
  sheets: [
    {
      sheetID: 'YYYYY',
      files: [
        {
          prefix: '_',
          keyColumns: ['en'],
          valueColumns: ['zh'],
          filePath: 'zh.json'
        },
        {
          prefix: '_',
          keyColumns: ['en'],
          valueColumns: ['ja'],
          filePath: 'ja.json'
        },
      ],
    },
  ],
}

Output

Two json files:

// zh.json
{
  "_Engineer": "工程師",
  "_Homepage": "首頁",
  "_Frontend": "前端",
  "_Backend": "後端"
}
// ja.json
{
  "_Engineer": "エンジニア",
  "_Homepage": "ホームページ",
  "_Frontend": "フロントエンド",
  "_Backend": "バックエンド"
}