json-from-gsheet

1.0.4 • Public • Published

Sheet template: https://docs.google.com/spreadsheets/d/1TA79qZ0TVai4XwFH4OUbmxIfxndnp9p09x7lh9MweqQ/edit?usp=sharing

Installation

yarn add json-from-gsheet   

or

npm i json-from-gsheet

Usage:

spreadsheetId - You can get it from the spreadsheet url which is placed after /spreadsheets/d/. Ex: spreadsheets/d/{YOUR_SPREADSHEET_ID}.
apiKey - get it from your Google Console. Learn more.
tabName - tab name in your spreadsheet, which is shown on the bottom of the page. Ex: Sheet1.
savePath - the path where you want to store your translation files.

const { sheetToJSON } = require('json-from-gsheet')


sheetToJSON({
    spreadsheetId: 'SPREADSHEET_ID',
    apiKey: 'API_KEY',
    tabName: 'TAB_NAME',
    savePath: 'PATH_TO_SAVE_FILES'
})

Example:

sheetToJSON({
    spreadsheetId: 'SPREADSHEET_ID',
    apiKey: 'API_KEY',
    tabName: 'TAB_NAME',
    savePath: './src/i18n/locales'
})

Output:

It outputs languages.json file in the root folder of the path you passed.
Screen Shot 2021-10-12 at 08 23 17

Then it outputs all [language].json files in the passed path.

Screen Shot 2021-10-12 at 08 22 46

Here is how [language].json looks like after it is parsed from the sheet Screen Shot 2021-10-12 at 08 27 13

Package Sidebar

Install

npm i json-from-gsheet

Weekly Downloads

3

Version

1.0.4

License

MIT

Unpacked Size

7.22 kB

Total Files

6

Last publish

Collaborators

  • mukhammadali