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

xlsx-json-parser

v0.3.5

Published

Parse xls/xlsx to json. i18next format

Downloads

16

Readme

xlsx-json-parser

Build Status NPM version Downloads License Issues PRs Welcome dependencies status devDependencies status Codacy Badge

Description and nuances

xlsx to JSON parser. Also support i18next format. Relies on node-xlsx.

Yep, it can append new files to exist now! Cheers 😎

What's new

  • v.0.3.5 - Update Readme.md
  • v.0.3.4 - Improve recursiveSearchValues & update tests
  • v.0.3.3 - Update Readme.md
  • v.0.3.2 - Fix known issues with one level template
  • v.0.3.1 - Update Readme.md
  • v.0.3.0 - Add config tests. Fix parser. Now it's work as NPM module correctly
  • v.0.2.5 - Codystyle fixes
  • v.0.2.4 - Remove async write file & some refactoring
  • v.0.2.3 - Add author's contacts
  • v.0.2.2 - Add jest testing
  • v.0.2.1 - Refactoring
  • v.0.2.0 - Add append to exist files
  • v.0.1.0 - First init

Install

npm i xlsx-json-parser

Then add folder xlsx (you can change it in xlsx-json-parser.config.js) in your project folder

Usage

In command line

node node_modules/xlsx-json-parser

You can add this line to your package.json in scripts section

"scripts": {
    "xlsx-parse": "node node_modules/xlsx-json-parser"
  }

And when you need to parse xlsx type in your console npm run xlsx-parse

Using with arguments

node node_modules/xlsx-json-parser --ln=listNumber --xlsx=xlsxDir --json=jsonDir --wfn
Where

--ln - List number
--xlsx - Path to xlxs --json - Path to json
--wfn - With file names for json files
You can change default arguments in xlsx-json-parser.config.js

Config file

Config file xlsx-json-parser.config.js looks like

const config = {
  xlsxDir: 'xlsx',
  jsonDir: 'json',
  listNumber: 1,
  withFilenames: false,
  fileTemplate(lang, array) {
    return `{
  "${lang}": {
    "translations": ${JSON.stringify(array)}
  }
}`;
  },
};

module.exports = config;

You can overwrite it by put xlsx-json-parser.config.js to your directory

Where

xlsxDir - default folder with xlsx files
jsonDir - default folder for json files
listNumber - Number of needed list in Excel file
withFilenames - Add to json files name of xlsx files if false, json files will be overwritten fileTemplate - method for set how json might looks, where lang - is current language for file, array - items for this langugae

i18next Format

By default keys for all langs parser get value from first lang

{
  "lang": {
    "translations": {
      "key": "value",
      "another_key": "another value"
    }
  }
}

You can change format in xlsx-json-parser.config.js

Files

Parser looks into xlsxDir and parse all xls/xlsx files.
Return filenames looks like {lang}_{xlsxFileName}.json

Xlsx format

To correct parsing you need next format - First row in xlsx file is for languages. Rows are for keys and values.

Append to exist files

Yep! It can be append to exist files if your JSON file format in config equal to your exist JSON view.

Templates

If you write next template

fileTemplate(lang, array) {
    return `{
  "${lang}":  ${JSON.stringify(array)}
}`;
    }

You recieve

{
  "lang": {
      "key": "value",
      "another_key": "another value"
  }
}

If you write next template

fileTemplate(lang, array) {
    return `${JSON.stringify(array)}`;
    }

You recieve

{
  "key": "value",
  "another_key": "another value"
}