CSVParse for Node.js


Option group_columns_by_name

When activated by settings its value to true, the group_columns_by_name option will convert the return values into arrays of values when multiple columns of the same name are found.

The option implies the usage of the columns mode where records are returned as literal objects. An error is thrown if the columns mode is not activated.

  • Type: boolean
  • Optional
  • Default: false (a one character comma)
  • Since: 4.10.0
  • Related: columns — see Available Options
  • History: prior to version 5.0.0, this option was named columns_duplicates_to_array.


The group_columns_by_name example contains a CSV data set with two columns named "friend". Without the group_columns_by_name option, only the last friend will be available. Instead, every friend is returned in the form of an array:

import assert from 'node:assert';
import { parse } from 'csv-parse';

`.trim(), {
  columns: true,
  group_columns_by_name: true
}, function(err, records){
    records, [{
      username: 'porthos',
      friend: ['athos', 'aramis']
    }, {
      username: 'd_artagnan',
      friend: ['porthos', 'athos']


The Node.js CSV project is an open source product hosted on GitHub and developed by Adaltas.