Created
July 2, 2025 23:50
-
-
Save alecGraves/fb5533b9b41ab7489be0029a0d313975 to your computer and use it in GitHub Desktop.
Convert an enpass .csv to keepass input .csv format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# convert an enpass .csv to keepassxc input .csv format | |
# Steps: | |
# 1. Export your enpass to a csv: File > export > .csv > "export.csv" > Export | |
# 2. Run this script from the same folder as export.csv | |
# 3. Import "export_migrated.csv" into keepassxc. | |
import csv | |
with open("export.csv", "r") as f: | |
data = list(csv.reader(f)) | |
def convert_row(items): | |
group = "Enpass" | |
title = items[0] | |
user = "" | |
password = "" | |
url = "" | |
exclude = [0] | |
# find first | |
for i, val in enumerate(items): | |
if not user and (val.lower() == "username" or val.lower() == "login" | |
or val.lower() == "e-mail"): | |
user = items[i+1] | |
exclude.extend([i, i+1]) | |
elif not password and val.lower() == "*password": | |
password = items[i+1] | |
exclude.extend([i, i+1]) | |
elif not url and val.lower() == "url" or val.lower() == "website": | |
url = items[i+1] | |
exclude.extend([i, i+1]) | |
if val in ["E-mail", "ADDITIONAL DETAILS", "Phone number", | |
"One-time code", "Security question", "*Security answer", | |
"Access"]: | |
if items[i+1] == "": | |
exclude.extend([i, i+1]) | |
orig = [i for idx, i in enumerate(items) if idx not in exclude] | |
notes = "; ".join(orig) | |
return [group, title, user, password, url, notes] | |
with open("export_migrated.csv", "w") as f: | |
writer = csv.writer(f, delimiter=',', quoting=csv.QUOTE_ALL) | |
for line in data: | |
writer.writerow(convert_row(line)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment