Skip to content

A webpack module to intelligently load csv files

License

Notifications You must be signed in to change notification settings

Daeluse/csv-loader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webpack csv loader

npm npm

Purpose

This CSV loader automatically converts data types, making it easy to import and start using data.

Installation

Install with yarn:

yarn add csv-loader

Install with npm:

npm install -S csv-loader

Usage

Add the csv-loader to your webpack 2 configuration:

const config = {
  module: {
    rules: [
      {
        test: /\.csv$/,
        loader: 'csv-loader',
        options: {
          dynamicTyping: true,
          header: true,
          skipEmptyLines: true
        }
      }
    ]
  }

The loader will translate csv files into JSON, with the following settings:

  • automatically convert columns to the proper data type,
  • parse the CSV header
  • skip any blank lines in the file

Configuration

Any options supported by Papa Parse can be passed to this loader with the options object. The current Papa Parse API is available here.

Not just a CSV loader

This module works with any column based file separated by deliminators. Simply set which extension to parse and the loader will automatically figure out which deliminator to use by default. The deliminator can also be manually set.

Credits

About

A webpack module to intelligently load csv files

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%