# JavaScript CSV libraries

JavaScript CSV libraries parse comma-separated text into rows and turn rows back into CSV. A streaming parser reads a large file row by row rather than loading the whole file into memory. These libraries handle spreadsheet uploads, data exports, and bulk imports in web apps and Node.js services.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [d3-dsv](#d-dsv) | 132.6M | 446 | Nov 2026 | ISC |
| [@fast-csv/format](#fast-csv-format) | 114.3M | 1.8K | Oct 2026 | MIT |
| [@fast-csv/parse](#fast-csv-parse) | 114.0M | 1.8K | Oct 2026 | MIT |
| [csv-parse](#csv-parse) | 109.4M | 4.3K | Sep 2026 | MIT |
| [ExcelJS](#exceljs) | 105.0M | 15.5K | Oct 2023 | MIT |
| [Papa Parse](#papa-parse) | 96.6M | 13.6K | Nov 2026 | MIT |
| [xlsx](#xlsx) | 60.5M | 36.3K | Jul 2024 | Apache-2.0 |
| [csv-stringify](#csv-stringify) | 50.3M | 4.3K | Sep 2026 | MIT |

Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[d3-dsv](#d-dsv) has the most monthly downloads in this comparison, at 132.6M.

## Capabilities

| Library | Parse CSV | Write CSV | Incremental CSV input |
| --- | --- | --- | --- |
| [d3-dsv](#d-dsv) | Yes | Yes | No |
| [@fast-csv/format](#fast-csv-format) | No | Yes | No |
| [@fast-csv/parse](#fast-csv-parse) | Yes | No | Yes |
| [csv-parse](#csv-parse) | Yes | No | Yes |
| [ExcelJS](#exceljs) | Yes | Yes | Yes |
| [Papa Parse](#papa-parse) | Yes | Yes | Yes |
| [xlsx](#xlsx) | Yes | Yes | No |
| [csv-stringify](#csv-stringify) | No | Yes | No |

## Libraries

### d3-dsv

[GitHub](https://github.com/d3/d3-dsv) · [npm](https://www.npmjs.com/package/d3-dsv) · [Docs](https://d3js.org/d3-dsv)

Parses and formats CSV, TSV and other single-character delimited text.

- Downloads / mo: 132.6M
- Stars: 446
- Last release: 3.0.2
- License: ISC
- Capabilities: [From the d3-dsv docs](https://d3js.org/d3-dsv)

**Strengths**

- **Parses and formats CSV/TSV.** Convert delimited text into rows and serialize records back to text.
- **Converts row values explicitly.** Supply a row conversion function when numbers or dates are required.

**Watch out for**

- **Object parsing needs unsafe-eval.** Use parseRows when the content security policy blocks generated code.
- **Duplicate column names overwrite values.** Use parseRows to retain every value under repeated column names.

```sh
npm install d3-dsv
```

**mapbox/geojson.io** (2.3K stars)

[mapbox/geojson.io](https://github.com/mapbox/geojson.io) 

```javascript
export function csvToGeoJSON(
  csv: string,
  options: ImportOptions['csvOptions'],
  progress: ProgressCb
): Promise<FeatureCollection> {
  if (!options) throw new Error('Options should not be undefined');
  const { kind, delimiter } = options;

  let i = 0;
  const rows = dsvFormat(delimiter).parse(csv);
  const features: Feature[] = [];

  // Preflight checks
  switch (kind) {
    case 'geojson':
    case 'wkt':
    case 'polyline':
    case 'lonlat': {
      break;
    }
  }

  progress({ total: rows.length, done: 0 });

  for (const row of rows) {
    const castRow: JsonObject = options.autoType
      ? autoType(row, options)
      : (row as JsonObject);
    switch (kind) {
      case 'lonlat': {
        const feature = castRowLonLat(
          castRow,
          EnforcedLonLatOptions.parse(options)
        );
        if (feature) {
          features.push(feature);
        }
        break;
      }
      case 'wkt': {
        const feature = castRowWKT(castRow, EnforcedWKTOptions.parse(options));
        if (feature) {
          features.push(feature);
        }
        break;
      }
      case 'geojson': {
        const feature = castRowGeoJSON(
          castRow,
          EnforcedWKTOptions.parse(options)
        );
        if (feature) {
          features.push(feature);
        }
        break;
      }
      case 'polyline': {
        const feature = castRowPolyline(
          castRow,
          EnforcedWKTOptions.parse(options)
        );
        if (feature) {
          features.push(feature);
        }
        break;
      }
    }
    progress({ total: rows.length, done: ++i });
  }

  return {
    type: 'FeatureCollection',
    features: features
  };
}
```

[app/lib/convert/local/csv_to_geojson.ts](https://github.com/mapbox/geojson.io/blob/e62e8cbaedd5c449980fde6e70fd8719486bd5b5/app/lib/convert/local/csv_to_geojson.ts#L100-L174) · [More projects using d3-dsv →](https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20projects%20using%20d3-dsv%20to%20import%20CSV%20rows%2C%20format%20downloadable%20files%20and%20transform%20datasets&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import { csvParse } from 'd3-dsv';

const rows = csvParse('name,score\nAda,42');
console.log(rows);

```

From [API reference](https://d3js.org/d3-dsv)

### @fast-csv/format

[GitHub](https://github.com/C2FO/fast-csv) · [npm](https://www.npmjs.com/package/@fast-csv/format) · [Docs](https://c2fo.github.io/fast-csv/docs/formatting/methods/)

Formats rows into CSV or other delimited text in Node.js.

- Downloads / mo: 114.3M
- Stars: 1.8K
- Last release: 5.0.8
- License: MIT
- Capabilities: [From the @fast-csv/format docs](https://c2fo.github.io/fast-csv/docs/formatting/methods/)

**Watch out for**

- **Single-character delimiters only.** Pick a one-character field delimiter such as a semicolon or a tab.
- **Disabled quoting can add columns.** Keep quoting on when a field can contain the delimiter.

```sh
npm install @fast-csv/format
```

**solana-foundation/explorer** (858 stars)

[solana-foundation/explorer](https://github.com/solana-foundation/explorer) 

```javascript
export async function generateReceiptCsv(
    receipt: FormattedReceipt,
    signature: string,
    usdValue?: string,
): Promise<void> {
    const rows = buildReceiptCsvRows(receipt, signature, usdValue);
    const csv = await writeToString(rows, { headers: [...CSV_HEADERS] });

    const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
    const url = URL.createObjectURL(blob);
    try {
        const link = document.createElement('a');
        link.href = url;
        link.download = `solana-receipt-${signature}.csv`;
        document.body.appendChild(link);
        try {
            link.click();
        } finally {
            document.body.removeChild(link);
        }
    } finally {
        URL.revokeObjectURL(url);
    }
}
```

[app/features/receipt/lib/generate-receipt-csv.ts](https://github.com/solana-foundation/explorer/blob/62e47975f463f6e09531deb072ebf36f7ffb0adf/app/features/receipt/lib/generate-receipt-csv.ts#L82-L105) · [More projects using @fast-csv/format →](https://dashboard.exa.ai/playground/search?q=%40fast-csv/format%20GitHub%20projects)

**Quickstart**

```javascript
import { writeToString } from '@fast-csv/format';

const csv = await writeToString([{ name: 'Ada', score: 42 }], { headers: true });
console.log(csv);

```

From [index.d.ts](https://c2fo.github.io/fast-csv/docs/formatting/methods/)

### @fast-csv/parse

[GitHub](https://github.com/C2FO/fast-csv) · [npm](https://www.npmjs.com/package/@fast-csv/parse) · [Docs](https://c2fo.github.io/fast-csv/docs/parsing/methods/)

Parses CSV or other delimited files in Node.js.

- Downloads / mo: 114.0M
- Stars: 1.8K
- Last release: 5.0.8
- License: MIT
- Capabilities: [From the @fast-csv/parse docs](https://c2fo.github.io/fast-csv/docs/parsing/methods/)

**Strengths**

- **Streams large files.** Parsing streams rows without holding a large file in memory.
- **Reads headers from the first row.** Setting headers to true keys each row by the names in the first row.

**Watch out for**

- **Single-character delimiters only.** Pick a one-character delimiter such as a semicolon or a tab.

```sh
npm install @fast-csv/parse
```

**jvalue/jayvee** (178 stars)

[jvalue/jayvee](https://github.com/jvalue/jayvee) 

```javascript
async function parseAsCSV(
  text: string,
  parseOptions: ParserOptionsArgs,
): Promise<string[][]> {
  return new Promise((resolve, reject) => {
    const rows: string[][] = [];
    parseStringAsCsv(text, parseOptions)
      .on('data', (row: string[]) => {
        rows.push(row);
      })
      .on('error', (error) =>
        reject(
          new Error(
            `Unexpected error while parsing CSV: ${error.name}: ${error.message}`,
          ),
        ),
      )
      .on(
        'data-invalid',
        (row: Row | null, rowCount: number, reason?: string) =>
          reject(
            new Error(
              `Invalid row ${rowCount}: ${
                reason ?? 'Unknwon reason'
              }: ${JSON.stringify(row ?? '')}`,
            ),
          ),
      )
      .on('end', () => {
        resolve(rows);
      });
  });
}

```

[libs/extensions/tabular/exec/src/lib/csv-interpreter-executor.ts](https://github.com/jvalue/jayvee/blob/f0c3d994778d20f40db4b29b57a6b97314ca3aa7/libs/extensions/tabular/exec/src/lib/csv-interpreter-executor.ts#L77-L109) · [More projects using @fast-csv/parse →](https://dashboard.exa.ai/playground/search?q=%40fast-csv/parse%20GitHub%20projects)

**Quickstart**

```javascript
import { parseString } from '@fast-csv/parse';

parseString('name,score\nAda,42', { headers: true })
  .on('error', console.error)
  .on('data', console.log);

```

From [index.d.ts](https://c2fo.github.io/fast-csv/docs/parsing/methods/)

### csv-parse

[GitHub](https://github.com/adaltas/node-csv) · [npm](https://www.npmjs.com/package/csv-parse) · [Docs](https://csv.js.org/parse/api/sync/)

Parses CSV into records through streaming, callback, and synchronous APIs.

- Downloads / mo: 109.4M
- Stars: 4.3K
- Last release: 7.0.3
- License: MIT
- Capabilities: [From the csv-parse docs](https://csv.js.org/parse/api/sync/)

**Strengths**

- **Offers streaming and synchronous APIs.** Choose streamed records or a direct call returning the complete result.
- **Maps columns to object fields.** Read named records using header-derived or explicitly configured columns.

**Watch out for**

- **Sync parsing retains every record.** Use streaming when the complete input and result exceed available memory.

```sh
npm install csv-parse
```

**simstudioai/sim** (30.1K stars)

[simstudioai/sim](https://github.com/simstudioai/sim) 

```javascript
export async function parseCsvBuffer(
  input: Buffer | Uint8Array | string,
  delimiter = ','
): Promise<{
  headers: string[]
  rows: Record<string, unknown>[]
  rejections: CsvRejectionSummary
}> {
  const { parse } = await import('csv-parse/sync')

  const text = decodeCsvText(input)

  let headers: string[] = []
  const rejections = createCsvRejectionCollector()
  const options = csvParseOptions(
    delimiter,
    (h) => {
      headers = h
    },
    rejections.onSkip
  )
  // double-cast-allowed: shared csvParseOptions() loses the `columns` literal that drives
  // csv-parse's record-vs-string[][] overload, but `columns` is always set so records are objects
  const parsed = parse(text, options) as unknown as Record<string, unknown>[]

  if (parsed.length === 0) {
    throw new OrchestrationError('validation', 'CSV file has no data rows')
  }

  if (headers.length === 0) {
    throw new OrchestrationError('validation', 'CSV file has no headers')
  }

  return { headers, rows: parsed, rejections: rejections.summary }
}
```

[apps/sim/lib/table/import.ts](https://github.com/simstudioai/sim/blob/edf5f0a47da8147466cb893c0a1666058331d42e/apps/sim/lib/table/import.ts#L344-L378) · [More projects using csv-parse →](https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20projects%20using%20csv-parse%20to%20import%20CSV%20rows%2C%20format%20downloadable%20files%20and%20transform%20datasets&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import assert from "node:assert";
import { parse } from "csv-parse/sync";

const input = `
"key_1","key_2"
"value 1","value 2"
`;
const records = parse(input, {
  columns: true,
  skip_empty_lines: true,
});
assert.deepStrictEqual(records, [{ key_1: "value 1", key_2: "value 2" }]);

```

From [Sync API](https://csv.js.org/parse/api/sync/)

### ExcelJS

[GitHub](https://github.com/exceljs/exceljs) · [npm](https://www.npmjs.com/package/exceljs) · [Docs](https://cdn.jsdelivr.net/npm/exceljs@4.4.0/README.md)

Reads and writes Excel workbooks and CSV files.

- Downloads / mo: 105.0M
- Stars: 15.5K
- Last release: 4.4.0
- License: MIT
- Capabilities: [From the ExcelJS docs](https://cdn.jsdelivr.net/npm/exceljs@4.4.0/README.md)

```sh
npm install exceljs
```

**apitable/apitable** (15.7K stars)

[apitable/apitable](https://github.com/apitable/apitable) 

```javascript
const exportCSV = async (workbook: Workbook, fileName: string, isView?: boolean) => {
  await workbook.csv.writeBuffer({ encoding: 'UTF-8' }).then((buffer) => {
    const blob = new Blob(['\uFEFF' + buffer], { type: 'text/csv;charset=utf-8;' });
    const link = document.createElement('a');
    link.href = window.URL.createObjectURL(blob);
    link.download = `${fileName}.csv`;
    link.click();
    Message.success({
      content: isView ? t(Strings.import_view_data_succeed) : t(Strings.import_file_data_succeed),
    });
  });
};

```

[packages/datasheet/src/pc/utils/catalog.ts](https://github.com/apitable/apitable/blob/c9255a752a85913e2e6b362ff6c306b0fc3585df/packages/datasheet/src/pc/utils/catalog.ts#L335-L346) · [More projects using ExcelJS →](https://dashboard.exa.ai/playground/search?q=exceljs%20GitHub%20projects)

**Quickstart**

```javascript
const ExcelJS = require('exceljs');

const workbook = new ExcelJS.Workbook();
workbook.csv.readFile('input.csv').then(worksheet => {
  console.log(worksheet.rowCount);
});

```

From [README.md](https://cdn.jsdelivr.net/npm/exceljs@4.4.0/README.md)

### Papa Parse

[GitHub](https://github.com/mholt/PapaParse) · [npm](https://www.npmjs.com/package/papaparse) · [Docs](https://www.papaparse.com/docs)

Parses delimited text in browsers and Node.js and serializes records back to CSV.

- Downloads / mo: 96.6M
- Stars: 13.6K
- Last release: 5.7.1
- License: MIT
- Capabilities: [From the Papa Parse docs](https://www.papaparse.com/docs)

**Strengths**

- **Detects common delimiters automatically.** Leave delimiter blank to infer a separator from the configured candidates.
- **Runs parsing in browser workers.** Use worker mode to keep the page responsive during parsing.

**Watch out for**

- **Streaming changes completion results.** Read streamed rows in step or chunk callbacks, rather than complete.
- **European numbers need normalization.** Swap decimal commas and grouping dots before enabling dynamicTyping.

```sh
npm install papaparse
```

**TryGhost/Ghost** (55.8K stars)

[TryGhost/Ghost](https://github.com/TryGhost/Ghost) 

```javascript
export default function serialize(
  rows: Array<Record<string, unknown>>,
  { columns, header = true }: SerializeOptions = {},
): string {
  return papaparse.unparse(rows, { columns, header, escapeFormulae: true });
}
```

[ghost/core/server/services/members/import-export/csv/serialize.ts](https://github.com/TryGhost/Ghost/blob/6091cc5bc67b040b4a27b713ee643de65fb0c6ce/ghost/core/server/services/members/import-export/csv/serialize.ts#L13-L18) · [More projects using Papa Parse →](https://dashboard.exa.ai/playground/search?q=JavaScript%20TypeScript%20projects%20using%20papaparse%20to%20import%20CSV%20rows%2C%20format%20downloadable%20files%20and%20transform%20datasets&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```javascript
import Papa from 'papaparse';

const result = Papa.parse('name,score\nAda,42', { header: true });
console.log(result.data);

```

From [Papa Parse docs](https://www.papaparse.com/docs)

### xlsx

[GitHub](https://github.com/SheetJS/sheetjs) · [npm](https://www.npmjs.com/package/xlsx) · [Docs](https://docs.sheetjs.com/docs/api/)

Parses and writes spreadsheet data.

- Downloads / mo: 60.5M
- Stars: 36.3K
- Last release: 0.20.3
- License: Apache-2.0
- Capabilities: [From the xlsx docs](https://docs.sheetjs.com/docs/api/)

**Watch out for**

- **readFile skips browsers.** In the browser, pass file data to read instead of a filename.

```sh
npm i --save https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz
```

**Quickstart**

```javascript
import * as XLSX from 'xlsx';

const workbook = XLSX.read('name,score\nAda,42', { type: 'string' });
console.log(workbook.SheetNames);

```

From [API reference](https://docs.sheetjs.com/docs/api/) · [Find projects using xlsx →](https://dashboard.exa.ai/playground/search?q=xlsx%20GitHub%20projects)

### csv-stringify

[GitHub](https://github.com/adaltas/node-csv) · [npm](https://www.npmjs.com/package/csv-stringify) · [Docs](https://csv.js.org/stringify/api/sync/)

Converts records into CSV text through the Node.js stream API, with synchronous and callback options.

- Downloads / mo: 50.3M
- Stars: 4.3K
- Last release: 6.9.0
- License: MIT
- Capabilities: [From the csv-stringify docs](https://csv.js.org/stringify/api/sync/)

**Strengths**

- **Custom formatters and headers.** Options set formatters, delimiters, quotes, escape characters, and the header row.
- **No external dependencies.** The package installs with no external dependency.

**Watch out for**

- **Writes only.** Parse CSV with its companion package csv-parse.

```sh
npm install csv-stringify
```

**gristlabs/grist-core** (12.1K stars)

[gristlabs/grist-core](https://github.com/gristlabs/grist-core) 

```javascript
function convertToDsv(data: ExportData, options: ConvertToDsvOptions) {
  const { rowIds, access, columns: viewColumns } = data;
  const { delimiter, header } = options;
  // create formatters for columns
  const formatters = viewColumns.map(col => col.formatter);
  // Arrange the data into a row-indexed matrix, starting with column headers.
  const csvMatrix = [viewColumns.map(col => getExportHeader(col, header))];
  // populate all the rows with values as strings
  rowIds.forEach((row) => {
    csvMatrix.push(access.map((getter, c) => formatters[c].formatAny(getter(row))));
  });
  return stringifyAsync(csvMatrix, { delimiter });
}
```

[app/server/lib/ExportDSV.ts](https://github.com/gristlabs/grist-core/blob/38a777c03000fb15abad1e8a93316fb9a75f1e89/app/server/lib/ExportDSV.ts#L135-L147) · [More projects using csv-stringify →](https://dashboard.exa.ai/playground/search?q=csv-stringify%20GitHub%20projects)

**Quickstart**

```javascript
import { stringify } from "csv-stringify/sync";
import assert from "node:assert";

const output = stringify([
  ["1", "2", "3", "4"],
  ["a", "b", "c", "d"],
]);

assert.equal(output, "1,2,3,4\na,b,c,d\n");

```

From [Sync API](https://csv.js.org/stringify/api/sync/)

## FAQ

### What is Papa Parse?

[Papa Parse](#papa-parse) parses delimited text in browsers and Node.js and serializes records back to CSV. It detects common delimiters when the delimiter option is left blank.

### What is csv-parse?

[csv-parse](#csv-parse) parses CSV into records in Node.js through streaming, callback, and synchronous APIs. Its companion package [csv-stringify](#csv-stringify) writes CSV.

### Papa Parse vs csv-parse: which should I use?

[Papa Parse](#papa-parse) parses files in the browser, with worker mode to keep the page responsive. [csv-parse](#csv-parse) implements the Node.js stream Transform API for server-side imports.

### How do I convert JSON to CSV in JavaScript?

In the browser, `Papa.unparse` from [Papa Parse](#papa-parse) turns an array of objects into CSV text. In Node.js, [csv-stringify](#csv-stringify) converts records into CSV through a stream or a synchronous call.

### Which library automatically detects the CSV delimiter?

Leave Papa Parse delimiter blank to try common delimiters or configured guesses.

### Can object-row parsing run under a strict content security policy?

parseRows works where a policy blocks the unsafe-eval that object parsing needs.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best JavaScript CSV libraries Papa Parse csv-parse Fast-CSV d3-dsv examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
