-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change order of columns #23
Comments
@sanderheilbron Currently only using the option |
Thanks @kauegimenes, but that does not always result in a legible document, and requires switching columns inside Excel, Numbers or Google Sheets. |
@sanderheilbron This would work for you? var jsonexport = require('jsonexport');
var contacts = [{
name: 'Bob',
lastname: 'Smith',
address: {
number: 1
}
},{
name: 'James',
lastname: 'David'
},{
name: 'Robert',
lastname: 'Miller'
},{
name: 'David',
lastname: 'Martin'
}];
jsonexport(contacts, {
headers: ['lastname', 'name', 'address.number']
},function(err, csv){
if(err) return console.log(err);
console.log(csv);
}); |
@sanderheilbron In v2.0.0 you can use the |
Hi @kauegimenes I've used your code example, and nine times out of ten the order of headers is correct. I noticed that the order could change sometimes because of the data set, but this is no issue for me. Before using this header option it was possible to rename the headers. I would like to know if there is still a possibilty to change the header name? Thanks for your effort and the v2.0.0 update! |
Hi @kauegimenes v2.0.2 supports my code to rename headers. |
@sanderheilbron Currently there is no way to rename headers, i will see if i can add this option later. |
@sanderheilbron v2.0.1 and v2.0.2 was only to get better performace. |
@kauegimenes v2.0.2 was the latest version when I installed the module. Just wanted to inform you about it. Yes, I will check which data set results in a different order of headers. |
@sanderheilbron What you think about this implementation to rename headers #25 ? |
@kauegimenes Looks awesome! A lot cleaner than my current solution. |
@sanderheilbron You should be able to use it with v2.0.4 |
@kauegimenes I've checked all my test data sets, but none of those sets result in a incorrect order of headers. Consider this issue as resolved. |
@sanderheilbron Thanks for the update. Feel free to create another issue if you think about another useful feature! |
@kauegimenes I've tested the rename header option and it works like a charm. Thanks!!! |
Would it be possible to set a specific order of columns?
The text was updated successfully, but these errors were encountered: