@zjcdaniel/json-to-xlsx
v0.0.1
Published
[![Version](https://img.shields.io/npm/v/json-to-xlsx.svg)](https://www.npmjs.com/package/json-to-xlsx) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](#)
Downloads
4
Readme
Welcome to json-to-xlsx 👋
🏠 Homepage
Install
npm install json-to-xlsx
Usage
import json2xlsx from "json-to-xlsx";
const mock = [
{name: 'Alice', age: 16, gender: 'female', score: 95},
{name: 'Bob', age: 18, gender: 'male', score: 83},
// ...
]
json2xlsx({
filename: 'example',
data: mock,
headers: ['name', 'age', 'gender', 'score', 'grade'],
format: {
grade: (row, key) => row.score > 90 ? 'A' : 'B' // just a example
}
})
this will make example.xlsx
| | A | B | C | D | E | |----|----|----|----|----|----| | 1 | name | age | gender | score | grade | | 2 | Alice | 16 | female | 95 | A | | 3 | Bob | 18 | male | 83 | B | | 4 | ... |
Author
👤 render
- Github: @zjcrender