Trying to export some data into csv in Javascript. Trying to find a npm module to do this... however - the data I have could have different headers per row...
for example my data could be this:
[ { name: 'John', color: 'Blue', age: 25 }, { name: 'Ursula', color: 'Red', food: 'pasta'},...]
Ideally, the csv would export to this:
name, color, age, food
John, Blue, 25,
Ursula, Red,,pasta
I've looked into fast-csv
and it doesn't seem to entertain dynamic headers (the above stated needs)... (in the above example, fast-csv
would have static headers provided by the first entry only (only name
,color
and age
))