0.1.1 • Published 3 years ago

xlsxon v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

xlsxon

Fork of xlsx_data_as_json

Adds minor functionality missing in the original package and includes some refactoring, however keeps the main package in tact.

Disclaimer: this package is pretty much useless, I only cooked this up to use in a different pet project without spending time on understanding the xlsx package which is used here

Usage

Installation

npm instal xlsxon

Examples

Server-side example usage

 const Xlsxon = require('xlsxon');

 const rows = Xlsxon.parseFile(__dirname + "/test.xlsx");

Browser-side example usage

import Xlsxon from 'xlsxon'

...

const fileReader = new FileReader()

fileReader.onload = () => {
    const data = fileReader.result

    const rows = Xlsxon.parse(data)
}

fileReader.readAsArrayBuffer(file)

Data sample

Given a following xlsx file

|   | A          | B                         | C     | D         | E |
|--:|------------|---------------------------|-------|-----------|---|
| 1 | Name       | Description               | Price | Image     |   |
| 2 | Piza       | Tomate sauce, Muzarella   | 10    | /img/piza |   |
| 3 | Hamburguer |                           | 12    |           |   |

you will receive the following json

[
    {
        "Name": "Piza",
        "Description": "Tomate sauce, Muzarella",
        "Price": "10",
        "Image": "/img/piza"
    },
    {
        "Name": "Hamburguer",
        "Description": "",
        "Price": "12",
        "Image": ""
    }
]
0.1.1

3 years ago

0.1.0

3 years ago