react-csv-formatter

1.0.4 • Public • Published

Getting started

Format your data as standard CSV.

Generate a CSV file from given data.

You will need four arguments to be passed in function named

formatAsCsv.

  1. Data as array of objects.
  2. Fields name in array format.
  3. Csv file name.
  4. Header name for csv file in array format.

Installation

Add formatAsCsv to your project by executing npm install react-csv-formatter or yarn add react-csv-formatter.

Sample Example.

Usage

Here's an example of basic usage:

import formatAsCsv from "react-csv-formatter";

let data = [ { "bio": "",company: "", designation: "", email:
"ashish@mixhubb.com",interested_in: "", name: "Ashish Ranjan", phone_number:
"1234567899", profile_image: null, profile_image_id: "", profile_image_url: "",
purpose: "attend", uid: "633b7f6a-48b6-48ee-b871-cb3c832a42a7" }, { bio: "",
company: "TESLA", designation: "CEO", email: "vijay@mixhubb.com", interested_in:
"", name: "Vijay Sirra", phone_number: "1234567890", profile_image: null,
profile_image_id: "f426939e-62c5-4ed7-b176-1b65b259e46e", profile_image_url: "",
purpose: "attend", uid: "73ab399c-985e-4a8b-b9c4-fbad2fc9b65b" } ],

let
fieldsNameToBeDisplayed=["uid","name","email","bio","phone_number","company","designation","interested_in","purpose","Age"];

let fileName="dataAsCsv";

let headerName=["Uid","Name","Email","Bio","Phone Number","Company","Designation","Interested In","Purpose","Age"];



formatAsCsv(data,fieldsNameToBeDisplayed,fileName,headerName);

Package Sidebar

Install

npm i react-csv-formatter

Weekly Downloads

0

Version

1.0.4

License

ISC

Unpacked Size

3.62 kB

Total Files

3

Last publish

Collaborators

  • ashishranjan7014