csv-excel-to-json
Version:
NPM Module to convert csv, excel to json format
35 lines (24 loc) • 657 B
Markdown
# csv-excel-to-json
## Introduction
> Module to convert CSV or Excel file to JSON output
## Code Samples
## syntax
```
convertToJson(input, output, optionalConfig);
```
## usage
```
var csvOrExcel = require('csv-excel-to-json');
csvOrExcel.convertToJson("D:\\ng\\sample.csv", "D:\\ng\\sample.json");
csvOrExcel.convertToJson("D:\\ng\\sample.xls", "D:\\ng\\sample-xls.json", {ignoreEmpty: false});
```
## default configuration
```
{
delimiter: ',', // for CSV
ignoreEmpty: true,
sheetNumber: 0 // In case of Excel file
}
```
## Installation
`npm install csv-excel-to-json --save`