Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@silencesys/xlsx-to-xml

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@silencesys/xlsx-to-xml

Export XLSX files to XML

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

XLSX to XML

This little tool converts two column XLSX Excel files to XML.


How to use

  1. Install this package with NPM
npm install -g @silencesys/xlsx-to-xml
  1. Create config file that will be used for the transformation
  2. Run the tool
xlsx-to-xml --input your_input_file.xlsx --output your_output_file.xml --config your_config.json

Available options

OptionDescription
--input, -iThe input file to be converted to xlsx
--output, -oThe output file to be created
--config, -cThe config file that will be used
--dirtySet this flag if you want to see XHTML tags added by XLSX transformer
--ignore-halvesSet this flag if you want to ignore rows that has one column empty
--help, -hShow help

Config file

The config file is a standard JSON file with following structure:

{
  "parentTagName": "dictionary",
  "rowTagName": "entry",
  "language": ["eng", "cze"],
  "stripTags": [
    "<span style=\"font-size:12pt;\">"
  ],
  "replaceTags": [
    {
      "from": "<span style=\"font-size:9pt;\">",
      "to": "<note>"
    },
  ],
  "divideBy": [
    [": "]
  ]
}

As you can see there are several options that can be used. There is no default config file as each use case is expected to be unique. You can use aforementioned snippet as your default config file.

OptionRequiredDescription
parentTagNameYesName of the parent tag.
rowTagNameYesName of the row tag.
languageOptionalList of languages that should be used.
stripTagsOptionalList of tags that should be stripped from the text. The list should contain only opening tags with all their attributes that should be removed.
replaceTagsOptionalList of tags that should be replaced. These tags should always be defined as a JSON object containing keys from and to. Only opening tags but with all attributes should be defined there.
divideByOptionalList of strings that should be used to divide the text. You might want to include spaces following after these characters as the division method is quite dumb.

How to write a config file

I'm sure you ask how am I supposed to know which XHTML tags will be used in my XLSX document after conversion. Well, for that purpose there is a very simple way. Just run following command:

xlsx-to-xml --input your_input_file.xlsx --dirty

This will output a dirty file containing XML with all XHTML tags. You can then decide which tags should be stripped or replaced and which should be kept. Just keep in mind that tags <dirty-list> and <dirty-row> are added by this tool and will be replaced by parentTagName and rowTagName respectively.


Contributing

All the code is open source and you can contribute to the project by creating pull requests.


License

This project is licensed under the MIT license.

Keywords

FAQs

Package last updated on 11 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc