# xlsx2json

> Convert xlsx to JSON.

Latest version **1.0.0** (published 2016-11-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install xlsx2json
pnpm add xlsx2json
yarn add xlsx2json
bun add xlsx2json
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-11-25 |
| First published | 2014-04-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.9.1 |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+7 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 16 |
| Author | daikiueda |
| Maintainers | daikiueda |
| Keywords | excel, xlsx, json |

## Links

- npm: https://www.npmjs.com/package/xlsx2json
- Repository: https://github.com/daikiueda/xlsx2json
- Issues: https://github.com/daikiueda/xlsx2json/issues
- npm.io page: https://npm.io/package/xlsx2json

## Dependencies (3)

- [xlsx](https://npm.io/package/xlsx.md) ^0.8.0
- [memoizee](https://npm.io/package/memoizee.md) ^0.4.1
- [csv-parse](https://npm.io/package/csv-parse.md) ^1.1.7

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-11-25
- 0.0.8 — 2015-03-22
- 0.0.6 — 2015-03-16
- 0.0.5 — 2015-01-27
- 0.0.4 — 2014-07-29
- 0.0.3 — 2014-07-02
- 0.0.2 — 2014-04-03
- 0.0.1 — 2014-04-02

## README

xlsx2json [![Build Status](https://travis-ci.org/daikiueda/xlsx2json.svg?branch=master)](https://travis-ci.org/daikiueda/xlsx2json) [![Coverage Status](https://coveralls.io/repos/daikiueda/xlsx2json/badge.png?branch=master)](https://coveralls.io/r/daikiueda/xlsx2json?branch=master) [![Code Climate](https://codeclimate.com/github/daikiueda/xlsx2json.png)](https://codeclimate.com/github/daikiueda/xlsx2json)
=========

[![NPM](https://nodei.co/npm/xlsx2json.png?compact=true)](https://nodei.co/npm/xlsx2json/)

Convert xlsx to JSON.

## Install

```Bash
$ npm install xlsx2json
```

## Usage

Simple usage : )

```JavaScript
var xlsx2json = require('xlsx2json');
xlsx2json('path_to_xlsx_file').then(jsonArray => {
    ...
});
```

### xlsx2json(pathToXlsx, [options], [callback])

#### Arguments

* __pathToXlsx__ String  

* __options__ Object _(optional)_
  * ```sheet```
    * {Number} (*zero-based sheet index)
    * {String}
    * {Array}
    
    If options.sheet is not set, all sheets will be passed as Array.
  * ```keysRow``` {Number} (*one-based row position)
  * ```mapping``` {Object}
  * ```dataStartingRow``` {Number} (*one-based row position)

* __callback__ Function _(optional)_  
  * function(error, jsonArray) {}

#### Returns

* __Promise__ 

for example : )  
convert [test/xlsx/with_header_information_and_keys_row.xlsx](https://github.com/daikiueda/xlsx2json/blob/master/test/xlsx/with_header_information_and_keys_row.xlsx) to jsonArray.

```JavaScript
var xlsx2json = require('xlsx2json');
xlsx2json(
    'test/xlsx/with_header_information_and_keys_row.xlsx',
    {
        dataStartingRow: 4,
        mapping: {
            'col_1': 'A',
            'col_2': 'B',
            'col_3': 'C'
        }
    }
}).then(jsonArray => { ... });
```
The jsonArray is as follows : )
```JSON
[
    [
        {"col_1": "value 1-A", "col_1": "value 1-B", "col_3": "value 1-C"},
        {"col_1": "value 2-A", "col_2": "value 2-B", "col_3": "value 2-C"}
    ]
]
```

The result is the structure of a three-dimensional array.  
In short, ```jsonArray[sheets][rows][cellValues]```


Alternatively, if the option.sheet is set (as a String or a Number), only specific sheet will be passed.

---
_Source: https://npm.io/package/xlsx2json · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
