Skip to content

hajareshyam/import-export-csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Follow the following steps to export data in CSV File (Working on import data functionality)

  • Step 1 - install the import-export-csv packages by typeing the following command

    $ npm i import-export-csv

  • Step 2 - Add required packages and read HTML template

    // Required package
    const { export2Csv } = require('import-export-csv');
  • Step 3 - Preapare Data for CSV like header and row data

    const header = ['car', 'price', 'color'];
    const row = [
    {
        "car": "Audi",
        "price": 40000,
        "color": "blue"
    }, {
        "car": "BMW",
        "price": 35000,
        "color": "black"
    }, {
        "car": "Porsche",
        "price": 60000,
        "color": "green"
    }, {
        "car": "Porsche1",
        "price": 600001,
        "color": "green1"
    }];
    
    let data = {
        header,
        row
    }
    // Filename
    options = {
        fileName: 'carDetails'
    }
  • Step 4 - After setting all parameters just pass data and option parameter to export2Csv function and thats done

    export2Csv(data, options).then((result)=>{
        console.log(result);
    }).catch((error)=> {
        console.log(error)
    })

Ask

If you found any dificaulty in this application then please refer my github exmple

End

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published