keepassxreboot / keepassxc

KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
https://keepassxc.org/
Other
21.39k stars 1.48k forks source link

Sort CSV rows when exporting #11427

Open ftrebien opened 2 weeks ago

ftrebien commented 2 weeks ago

Summary

When exporting to a CSV file, it would be helpful to allow entries to be exported in a natural sort order, ignoring the case. This should provide consistency across exports and make comparing databases easier.

Examples

Consider a database export with the following items in random order:

Group Title Username
Base/Work system B myuser3
Base/Work System A myuser11
Base/Work system A myuser2
Base/Home system C myuser4

With a natural sort order, the output would always be ordered by Group, then Title, then Username, and so on:

Group Title Username
Base/Home system C myuser4
Base/Work system A myuser2
Base/Work System A myuser11
Base/Work system B myuser3

Context

When items are in a random order, users need to manually sort each CSV file before comparing databases. Although an advanced merge feature is in development, there are some cases (such as comparing databases managed by different people) that may require manual resolution of the differences. For example, a user may choose to keep an older entry after learning a newer entry in another database is incorrect or poorly renamed, or they might prefer to resolve differences in various ways, such as assigning a more descriptive title, moving an entry to another group, or even splitting a conflicting entry into separate entries.

droidmonkey commented 2 weeks ago

CSV export is done in "database order" which applies no explicit column sorting. Database order is typically based on when entries are added to groups but can be modified by moving entries up and down in the entry view. We are not going to apply any explicit sorting to CSV exports. If you want to sort, use a CSV viewing program to apply the sorting you desire and save the file.

PS- Using CSV to compare databases is an anti-pattern and wouldn't help you in a merge scenario anyway. If databases do not share a lineage with each other then entries are considered completely different from each other in a merge.

ftrebien commented 2 weeks ago

Thank you for taking the time to respond. While I understand KeepassXC’s focus on database order, treating groups like ordered lists, I personally manage my databases as unordered sets of entries, which I find more maintainable, especially on mobile and with larger datasets. Adding optional sorting for CSV exports could broaden the feature’s utility, as in the case I described. I’ll leave it for your future consideration.

droidmonkey commented 2 weeks ago

I'll reopen this and tie it to implementation on an export wizard, similar to our new import wizard.