json-from-gsheet
v1.0.4
Published
Extract i18n translations from Google Spreadsheet to json files
Downloads
7
Maintainers
Readme
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.
Then it outputs all [language].json
files in the passed path.
Here is how [language].json
looks like after it is parsed from the sheet