node-csv icon indicating copy to clipboard operation
node-csv copied to clipboard

Assign row number to each record

Open bas080 opened this issue 3 years ago • 2 comments

Summary

The idea is to opt into adding a row number and having that value assigned to a configured property.

Motivation

It's handy for me because it allows my user interface to tell the user where that data has come from better.

Alternative

I have considered adding a row number to my CSV raw data before putting it in csv-parse.

Draft

parse({
  row: true, // will result in a row property added to each record
  row: 'some_other_field' // will assign the row number to that field.
})

bas080 avatar Mar 12 '22 10:03 bas080

Column number is also handy

-- https://delta.chat

bas080 avatar Mar 12 '22 10:03 bas080

I see there is a on_record option. It has lines let me check if it has columns too...

bas080 avatar Mar 12 '22 10:03 bas080