xlsx-to-directories

1.0.0 • Public • Published

Xlsx to Direcotries Core

xlsx-to-directories module expose one functionality that take a file with .xlsx extension and create a new directory for each row in the specified ouput directory.

Structure of the .xlsx file

A1 B1
1 Azienda1
2 Azienda2
... Azienda...

There must be two columns. Except for the first row that is intended as labels, the follwings rows must be of type number for the first column and type string for the second column.

How it works

Start parsing the file one row at a time. If it is the fist row (the row with the labels), do nothing. If the two columns of the row contains correct values, combine them into one single string. Otherwise do nothing for incorrect values. Create a new directory in the path specified in input using the new created srting as the directory name name. When there is no more rows left terminate the script.

How to use it

Install the module

npm i --save xlsx-to-directories

Import and usage

const xlsxToDir = require('xlsx-to-directories')
 
xlsxToDir('path_to_file', 'path_to_dir')
  .then(count => {
    console.log(`${count} new folder${count > 1 ? 's' : ''}`)
  })
  .catch(error => {
    console.error(error)
  })

Readme

Keywords

none

Package Sidebar

Install

npm i xlsx-to-directories

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

2.72 kB

Total Files

3

Last publish

Collaborators

  • jacopobonta