Prevent duplication when import

I have new entries that overlap with the existing ones in Bitwarden.

How can I import them without duplicating them?

@avbw Welcome to the forum!

Can you explain in a little more detail what you are trying to accomplish?

It seems that you have a Bitwarden vault that is already populated, and that you now have a CSV file (“new entries”) exported from some other app, which you would like to import into the Bitwarden account. You also state that your CSV file contains “entries that overlap with the existing ones in Bitwarden”. Assuming all of this is accurate, could you clarify the following:

  1. Does your CSV file contain any entries that do not overlap with existing Bitwarden records?

  2. For the entries that overlap, do you prefer that the “new entries” are not imported (keeping the existing entries without change), or that the existing entries are removed (and replaced by the “new entries”)?

Does your CSV file contain any entries that do not overlap with existing

Ofc, otherwise the import would be pointless.

For the entries that overlap, do you prefer that the “new entries” are not imported (keeping the existing entries without change), or that the existing entries are removed (and replaced by the “new entries”)?

If entry is already in BW, I don’t want it imported or changed at all. Only add new entries.

Not if your goal was to replace the existing values.

 

In this case, I think that your best bet is to remove the duplicates from the new CSV file before importing it into Bitwarden. You can automate this process using the Remove Duplicate Values feature in Excel.

There’s a few different ways that you could go about this, depending on what format your new CSV file has (e.g., whether it is an export from Bitwarden or from some other password manager), and whether your existing Bitwarden vault has any file attachments, non-text custom fields, credit cards, identities, or password histories that you don’t want to lose.

If you want to attempt this type of approach, and need further guidance, please let me know (and provide the information requested above).

I’m mainly using KeePassXC. I have a group of passwords that I want to sync with Bitwarden. When this group is updated, I want it uploaded to Bitwarden overriding the vault.

Currently, I can achieve this using “Purge vault & Upload”, but I’m looking for other ways, or, if it’s not possible, to open up a new suggestion.

I was looking in the documentation of bitwarden-cli, but nothing useful. Here’s the desired interface:

bitwarden-cli purge -f
keepassxc-cli export bw.kdbx | bitwarden-cli --import xml

Why not import all in Bitwarden and make it the main one instead of KeePassXC?

Because Bitwarden has better auto-fill and KeePassXC has better offline experience, and I want to get the best of both worlds.

This statement contradicts your previous statement about wanting to ignore the duplicates in the import file (preserving the corresponding Bitwarden vault entries). Now you say you want to override the Bitwarden vault entries.

Please clarify in more detail the desired behavior, and I will see if I can come up with a suggestion for how to accomplish it.

I’m fine with either ignoring or overriding already existing entries, whichever is easier to implement.

Well, the gist of my suggestion is:

  1. Export both vaults in CSV format.
  2. Copy the URLs from the Bitwarden CSV into the URL column of the KeePassXC CSV, pasting them into empty rows that have been inserted above the KeePassXC entries (just below the column headers). Optionally do the same for the username data (in case you have multiple accounts on the same site).
  3. Open the CSV in Excel, and use the Remove Duplicate Values tool to remove all rows in which the URLs (and usernames, if applicable) have a duplicate. This keeps the first instance and deletes all subsequent instances (i.e., those found in your KeePassXC export).
  4. Delete all rows that are empty except for the URL (or URL and username) — i.e., the rows that were pasted in from Bitwarden.
  5. Save the modified CSV.
  6. Import the modified CSV into Bitwarden.

The above procedure will leave preserve the Bitwarden entries, and import the unique entries from the KeePassXC export.