Fast and powerful CSV (delimited text) parser that gracefully handles large files and malformed input

Overview

Parse CSV with JavaScript

Papa Parse is the fastest in-browser CSV (or delimited text) parser for JavaScript. It is reliable and correct according to RFC 4180, and it comes with these features:

  • Easy to use
  • Parse CSV files directly (local or over the network)
  • Fast mode (is really fast)
  • Stream large files (even via HTTP)
  • Reverse parsing (converts JSON to CSV)
  • Auto-detect delimiter
  • Worker threads to keep your web page reactive
  • Header row support
  • Pause, resume, abort
  • Can convert numbers and booleans to their types
  • Optional jQuery integration to get files from <input type="file"> elements
  • One of the only parsers that correctly handles line-breaks and quotations

Papa Parse has no dependencies - not even jQuery.

Install

papaparse is available on npm. It can be installed with the following command:

npm install papaparse

If you don't want to use npm, papaparse.min.js can be downloaded to your project source.

Homepage & Demo

To learn how to use Papa Parse:

The website is hosted on Github Pages. Its content is also included in the docs folder of this repository. If you want to contribute on it just clone the master of this repository and open a pull request.

Papa Parse for Node

Papa Parse can parse a Readable Stream instead of a File when used in Node.js environments (in addition to plain strings). In this mode, encoding must, if specified, be a Node-supported character encoding. The Papa.LocalChunkSize, Papa.RemoteChunkSize , download, withCredentials and worker config options are unavailable.

Papa Parse can also parse in a node streaming style which makes .pipe available. Simply pipe the Readable Stream to the stream returned from Papa.parse(Papa.NODE_STREAM_INPUT, options). The Papa.LocalChunkSize, Papa.RemoteChunkSize , download, withCredentials, worker, step, and complete config options are unavailable. To register a callback with the stream to process data, use the data event like so: stream.on('data', callback) and to signal the end of stream, use the 'end' event like so: stream.on('end', callback).

Get Started

For usage instructions, see the homepage and, for more detail, the documentation.

Tests

Papa Parse is under test. Download this repository, run npm install, then npm test to run the tests.

Contributing

To discuss a new feature or ask a question, open an issue. To fix a bug, submit a pull request to be credited with the contributors! Remember, a pull request, with test, is best. You may also discuss on Twitter with #PapaParse or directly to me, @mholt6.

If you contribute a patch, ensure the tests suite is running correctly. We run continuous integration on each pull request and will not accept a patch that breaks the tests.

You might also like...

All information is taken from archived CSV files from the reformagh.ru website

All information is taken from archived CSV files from the reformagh.ru website

All information is taken from archived CSV files from the reformagh.ru website

Feb 8, 2022

An Obsidian Plugin that allows to export tables from a pane in reading mode to CSV files.

Obsidian Plugin "Table to CSV Exporter" This is my very first attempt in writing a plugin for Obsidian. I didn't even know TypeScript before (but Java

Dec 27, 2022

Download large files with progress.

Deno-DLWP Download large files with progress Example import { DLWP } from "https://deno.land/x/[email protected]/mod.ts"; const dlwp = new DLWP(); dlwp.dow

Dec 29, 2022

A fast, vanilla JS customisable select box/text input plugin for modern browsers ⚡

choices A fast, vanilla, lightweight (~16kb gzipped 🎉 ), configurable select plugin for modern browsers. Similar to Select2 and Selectize but without

Aug 9, 2022

AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.

AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.

Please use version 1.x as prior versions has a security flaw if you use user generated data to concat your SQL strings instead of providing them as a

Jan 9, 2023

The authentication-server is a node app that handles user registration, authentication & authorization with JWT.

The authentication-server is a node app that handles user registration, authentication & authorization with JWT.

Authentication Server The authentication-server is a node app that handles user registration, authentication & authorization with JWT. Here is the REP

Jul 24, 2022

Co-Pilot is a discord Bot designed to be the all-in-one, open-source Discord bot that handles all your server needs.

Co-Pilot is a discord Bot designed to be the all-in-one, open-source Discord bot that handles all your server needs.

Welcome to Co-Pilot Bot repo! 👋 🤖 Co-Pilot (All-in-one Discord Bot) Co-Pilot is a discord Bot designed to be the all-in-one, open-source Discord bot

Nov 11, 2022

A Cli that handles the creation of a basic express App that supports Husky configuration & static analysis tools

A Cli that handles the creation of a basic express App that supports Husky configuration & static analysis tools

@phazero/create-express-app · Create express app is a CLI that can generate boiler plate code for setting up an express app. Installation & Usage npx

Oct 29, 2022

Mabicord AIO is a Discord bot that handles MMORPG Mabinogi's bugle messages, designed to serve a single Discord server.

Welcome to NamVr Discord Bot Template 👋 An open source discord.js bot template which is based on official discord.js guide to get started on making y

Jul 13, 2022

A lightweight (~2kB) library to create range sliders that can capture a value or a range of values with one or two drag handles

range-slider-input A lightweight (~2kB) library to create range sliders that can capture a value or a range of values with one or two drag handles. Ex

Dec 24, 2022

Tag-input - A versetile tag input component built with Vue 3 Composition API

Tag-input - A versetile tag input component built with Vue 3 Composition API

TagInput A versetile tag input component built with Vue 3 Composition API. Please read this article to learn how to build this package step by step an

Oct 12, 2022

Vue-input-validator - 🛡️ Highly extensible & customizable input validator for Vue 2

Vue-input-validator - 🛡️ Highly extensible & customizable input validator for Vue 2

🛡️ Vue-input-validator demo! What is this package all about? By using this package, you can create input validators only with the help of a single di

May 26, 2022

A Bootstrap plugin to create input spinner elements for number input

A Bootstrap plugin to create input spinner elements for number input

bootstrap-input-spinner A Bootstrap / jQuery plugin to create input spinner elements for number input. Demo page with examples Examples with floating-

Nov 7, 2022

A phone input component that uses intl-tel-input for Laravel Filament

A phone input component that uses intl-tel-input for Laravel Filament

Filament Phone Input This package provides a phone input component for Laravel Filament. It uses International Telephone Input to provide a dropdown o

Nov 29, 2022

Color palette text parser to a function, compatible with GMT, GDAL, GRASS, PostGIS, ArcGIS

cpt2js Color palette text parser to a function, input compatible with GMT, GDAL, GRASS, PostGIS, ArcGIS Demo From GDAL docs: The text-based color conf

Dec 4, 2022

A tool set for CSS including fast detailed parser, walker, generator and lexer based on W3C specs and browser implementations

CSSTree CSSTree is a tool set for CSS: fast detailed parser (CSS → AST), walker (AST traversal), generator (AST → CSS) and lexer (validation and match

Dec 28, 2022

🦾 Tiny 2kb Markdown parser written, almost as fast and smart as Tony Stark

Starkdown 🦾 Starkdown is a Tiny 2kb Markdown parser written, almost as fast and smart as Tony Stark. npm i starkdown Motivation It is a continuation

Sep 22, 2022

Import flow for Excel (.xlsx) and CSV file with automated column matching and validation.

Import flow for Excel (.xlsx) and CSV file with automated column matching and validation.

RSI react-spreadsheet-import ⚡️ A component used for importing XLS / XLSX / CSV documents built with Chakra UI. Import flow combines: 📥 Uploader ⚙️ P

Dec 24, 2022

jQuery plugin to export a html table to JSON, XML, CSV, TSV, TXT, SQL, Word, Excel, PNG and PDF

tableExport.jquery.plugin Export HTML Table to CSV DOC JSON PDF PNG SQL TSV TXT XLS (Excel 2000 HTML format) XLSX (Excel 2007 Office Open XML format)

Dec 29, 2022
Releases(5.3.0)
  • 5.3.0(Aug 25, 2020)

    We are happy to annunce a new minor release of PapaParse.

    This release includes the following change:

    • Allow to escape formulae for safer opening on spreedsheet software (See: https://github.com/mholt/PapaParse/issues/793 for full details)
    Source code(tar.gz)
    Source code(zip)
  • 5.2.0(Apr 2, 2020)

    We are happy to announce version 5.2.0.

    This version contains a new feature that allows to perform post request when downloading files.

    It also fixes a ReDOS vulnerability issue. See https://github.com/mholt/PapaParse/issues/777 for more details.

    Source code(tar.gz)
    Source code(zip)
  • 5.1.0(Sep 17, 2019)

    The release brings a the option to use a function to determine the fields that will be quoted. This function accepts the cell value and column index as parameters. Thanks to @Puzzleton for contributing this feature.

    This release also includes some bug fixes. Thanks to all who contributed.

    Source code(tar.gz)
    Source code(zip)
  • 5.0.0(May 30, 2019)

    We are happy to announce a new major release of PapaParse.

    This relase (5.0.0) introduces the following changes:

    • We drop support for Node 6.x branch.
    • Workers are now loaded with inline blobs, which means that is only needed to specify the worker: true option and Paparse will load it's code from a blob
    • Step function returns only a single row
    • A function to transform header columns is added. The trimheader option is removed as it can be achieved with this new transform function.
    • The API throws now Error objects instead of using error Strings.
    • Handle delimiter guessing, when not all of the fields are quoted
    • Add ability to support escapeChar on unparse
    • Allow to specify the columns used for unparse
    • Add DelimitersToGuess config option

    Happy parsing!

    Source code(tar.gz)
    Source code(zip)
  • 5.0.0-beta.0(Nov 21, 2018)

    This is the first beta version of the 5 major version, which introduces the following changes:

    • We drop support for Node 6.x branch.
    • Workers are now loaded with inline blobs, which means that is only needed to specify the worker: true option and Paparse will load it's code from a blob
    • Step function returns only a single row
    • A function to transform header columns is added. The trimheader option is removed as it can be achieved with this new transform function.
    • The API throws now Error objects instead of using error Strings.

    Please test it and report issues if you have on it. As this is a beta version it should be installed with the following command:

    npm install papaparse@beta

    Source code(tar.gz)
    Source code(zip)
  • 4.6.0(Aug 1, 2018)

  • 4.5.0(Jun 4, 2018)

    This release brings several bug fixes and the the following improvements:

    • Serialize dates using ISO Format
    • Add config option to transform values before dynamic typing
    • Drop support for node v4 and add support for node v10
    • Add support for node-style streaming

    Thanks to @pushplay @efossas @gabegorelick and @trevorharwell for contributing to this release

    Source code(tar.gz)
    Source code(zip)
  • 4.4.0(Apr 23, 2018)

    This release brings several bug fixes and the the following improvements:

    • Add option to trim whitespace from headers
    • Upgrade dependencies to newer versions
    • Remove support for node 0.12
    • Add option to configure escape character
    • Add support for spaces between quotes and separators

    Thanks to @thSteve, @gabegorelick and @marius-wieschollek for contributing to this release.

    Source code(tar.gz)
    Source code(zip)
  • 4.3.0(Apr 27, 2017)

    • Allow to pass a function to DynamicFunction which should return for each field if dynamic typing should be applied.
    • Add support for download xhr headers.

    Thanks to @vyrak and @j--w for contributing

    Source code(tar.gz)
    Source code(zip)
  • 4.2.0(Mar 16, 2017)

    This release adds support for parsing NodeStreams, so papaparse can be used directly on NodeJS.

    Thanks to @LeviticusMB for implementing this.

    Source code(tar.gz)
    Source code(zip)
  • 4.1.0(Jan 16, 2015)

    This release is comprised mainly of internal re-factorings, but a few minor behavioral things changed. Most users will not be broken with this release:

    • fastMode is automatically enabled if no quotes (") are found in the input. Fast mode can be forced on or off by explicitly setting it to true or false, respectively.
    • The config object used to be checked for validity across all its fields, but this was a watering hole for bugs and no exceptions were thrown. We removed that logic and now expect the user to pass in valid config settings. Passing in bad values will probably result in errors during parsing.

    The internal refactoring that took place should help prepare Papa Parse for a possible direct Node.js port in the future. The overall number of lines of code was reduced by about 10%.

    Source code(tar.gz)
    Source code(zip)
  • 4.0.5(Nov 19, 2014)

    Papa Parse 4 sports a new core parser, completely rewritten from scratch, and is now the fastest CSV parser for the browser. Notable features include:

    • 5x to 10x speed boost thanks to a new parsing algorithm
    • Fast mode for even faster parsing, as long as the input has no quoted fields
    • You can now pause, resume, and abort parsing within the chunk callback
    • keepEmptyRows is replaced with skipEmptyLines. New default behavior is to keep empty lines unless you specify otherwise.
    • Comments can now start with more than a single character (like "//" instead of just "#")
    • Got rid of errors that weren't helpful; now any errors that are generated are always cause for concern
    • Bug fixes

    See the docs and the blog post for more information.

    Source code(tar.gz)
    Source code(zip)
  • 3.1.2(Sep 2, 2014)

  • 3.1.0(Sep 1, 2014)

    Several improvements and bug fixes.

    New

    • Pause, resume, and abort parsing. The step callback now receives a ParserHandle as an argument:
    step: function(results, handle) {
        // pausing makes the parse function asynchronous if it wasn't already
        handle.pause();
        // save a reference to it, then resume later:
        handle.resume();
        // you can also abort entirely:
        handle.abort();
    }
    
    • New chunk config callback. For parsing files only. Instead of being invoked for every row of parsed data, it is only invoked with every chunk of a file that is loaded. It receives by argument the results of the entire chunk.
    • New keepEmptyRows config property. If true, rows that are empty (blank or contain only whitespace) will be preserved.
    • New error config property. For use if FileReader encounters an error while opening a file.
    • New truncated meta property. Results meta now indicates, when using preview, whether the results were truncated. The value will only be true if the preview does not consume the entire input.
    • New Papa.DefaultDelimiter setting. Set to a comma (',') by default, this value is used if a delimiter is not set and the delimiter cannot be automatically detected.

    Fixed or changed

    • A bug in Firefox prevents FileReader from being used in a worker thread. Until they release that fix, FileReaderSync is used as a workaround. Note that FileReaderSync is not as performant. This workaround will be removed as soon as possible.
    • When converting JSON to CSV, a null value is now treated as an empty string rather than throwing an exception.
    • When using preview with header enabled, the preview value specifies how many rows of data, not how many rows total. In other words, 1 is added to the preview value. (For instance, before, preview: 10 with header: true would parse only 9 rows of data because the first was the header row. Now, 11 total rows are parsed to compensate for the header row.)
    • Handling a certain edge case of escaped quotes in fields correctly
    • Now firing complete callback properly when parsing with a worker thread

    Plus a few other minor improvements or internal changes.

    Source code(tar.gz)
    Source code(zip)
  • 3.0.0(Jul 16, 2014)

    Lots of improvements and new features.

    Added:

    • Download and parse files
    • Stream files over the network
    • "Unparse" utility (convert JSON to CSV)
    • Worker thread support
    • Option to skip commented lines
    • Callback for when all files are complete

    Improved/changed:

    • Structure of results
    • jQuery dependency removed but still available
    • Handling of misplaced quotes
    • Internals refactored
    • Better delimiter detection
    Source code(tar.gz)
    Source code(zip)
Owner
Matt Holt
M.S. Computer Science. Author of the Caddy Web Server, CertMagic, Papa Parse, JSON/curl-to-Go, Timeliner, Relica, and more...
Matt Holt
A JavaScript PDF generation library for Node and the browser

PDFKit A JavaScript PDF generation library for Node and the browser. Description PDFKit is a PDF document generation library for Node and the browser

null 8.5k Jan 7, 2023
Blaze is a file sharing progressive web app built using WebTorrent and WebSockets

Blaze is a file sharing progressive web app(PWA) that allows users to transfer files between multiple devices. I

Akash Hamirwasia 1.6k Jan 4, 2023
curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.

curl (cujoJS resource loader) All development for curl.js and cram.js has stopped. For the foreseeable future, we will continue to respond to issues o

The Javascript Architectural Toolkit 1.9k Dec 30, 2022
~900 byte minified CSV parser and builder. Smaller when compressed. Built in ESM only.

but-csv ~900 byte minified CSV parser and builder. Smaller when compressed. Built in ESM only. Doesn't care about headers, keyed rows, anything but st

Sam Thorogood 16 Nov 13, 2022
sessionStorage API which gracefully degrades to window.name & cookies when not available

sessionstorage The sessionStorage API is amazing and super useful when you need to store data temporarily in the browser. We used to abuse cookies for

null 22 Jul 25, 2022
History.js gracefully supports the HTML5 History/State APIs (pushState, replaceState, onPopState) in all browsers. Including continued support for data, titles, replaceState

History.js gracefully supports the HTML5 History/State APIs (pushState, replaceState, onPopState) in all browsers. Including continued support for data, titles, replaceState. Supports jQuery, MooTools and Prototype.

Browser State 10.8k Dec 26, 2022
A labeler component that Lays out text and overlays textual decorations like labels, predictions, and relations based on given data and handles user interactions on tokens.

react-text-annotator react-text-annotator is a labeler component that: Lays out text and overlays textual decorations like labels, predictions, and re

Microsoft 25 Dec 11, 2022
A powerful data visualization 2D/3D large-screen editor tool with low-code.

tp-editor(2D/3D)中文说明 A topology 2D/3D editor with nodejs, express, socket.io es6, HT for Web and vite. It's a powerful large-screen data visualization

Flying Li 11 Dec 25, 2022
Json-parser - A parser for json-objects without dependencies

Json Parser This is a experimental tool that I create for educational purposes, it's based in the jq works With this tool you can parse json-like stri

Gabriel Guerra 1 Jan 3, 2022
Tools for editing Shapefile, GeoJSON, TopoJSON and CSV files

Mapshaper Introduction Mapshaper is software for editing Shapefile, GeoJSON, TopoJSON, CSV and several other data formats, written in JavaScript. Maps

Matthew Bloch 3.2k Jan 2, 2023