A function to easily generate csv downloads of your json data. ✨
Install with npm:
npm i json-to-csv-export
Or load from a CDN:
<script src="https://cdn.jsdelivr.net/npm/json-to-csv-export"></script>
The first argument is data. This is all that is required.
<button onClick={() => csvDownload({ data: mockData })}> Download Data </button>
# | Property | Type | Requirement | Default | Description |
---|---|---|---|---|---|
1 | data | [] | required | array of objects | |
2 | filename | string | optional | "export.csv" | The filename. The .csv extention will be edded if not included in file name |
3 | delimiter | string | optional | ";" | fields separator |
4 | headers | string[] | optional | provided data object keys | List of column names that will be used in the final CSV file. |
Please help provide good data faster! Submit any issues and/or make a pull request!