sheetify-cli
v1.0.1
Published
CLI to convert files (js/json) into grouped .xlsx sheets and vise versa
Maintainers
Readme
Grouped Translation Files to Excel (TypeScript)
Node.js + TypeScript CLI tool to convert translation files like notifications.js / brand.json into .xlsx.
What it does
- Top columns are inferred from language keys inside each file (
en,ru,it, ...). - Rows are grouped per source file.
- Left key column is translation key (
key). - Missing keys in any language become empty cells.
- Nested objects are flattened using dot notation (
auth.login.title). - Root-level keys are supported too (
appName,save, etc.).
Install
npm install
npm run buildUsage
translations-to-excel to-xlsx --input <translations-root-folder> --output <output.xlsx>
translations-to-excel from-xlsx --input <input.xlsx> --out-dir <output-folder> [--format json|js]Example:
node dist/cli.js to-xlsx --input ./locales --output ./translations.xlsx
node dist/cli.js from-xlsx --input ./translations_grouped.xlsx --out-dir ./restored --format jsonOr with npm script:
npm run to-xlsx
npm run from-xlsxOutput format:
.xlsxonly
Import format is controlled by --format:
json-> writes<file>.jsonjs-> writes<file>.jsasmodule.exports = { ... }
Folder layout example:
locales/
notifications.js
brand.jsonEach file must contain language objects at the top level:
module.exports = {
en: {
title: "Hello"
},
ru: {
title: "Privet"
}
};Only this grouped structure is supported.
For .xlsx output:
- Each source file gets its own sheet.
Reverse command (xlsx -> files)
Use this to collect data from an .xlsx file and recreate translation files with key-value objects:
node dist/cli.js from-xlsx --input ./translations_grouped.xlsx --out-dir ./restored_locales --format jsonor:
node dist/cli.js from-xlsx --input ./translations_grouped.xlsx --out-dir ./restored_locales --format jsSupported translation files
The CLI reads translation files directly from the input folder (non-recursive).
.js,.cjs,.mjs,.json.jsonfiles are parsed as JSON.js,.cjs,.mjsfiles are loaded as module exports- Export/content must be an object
CommonJS example:
module.exports = {
common: {
hello: "Hello"
}
};