Skip to content

Instantly share code, notes, and snippets.

@KyleJamesWalker
Created February 17, 2021 20:14
Show Gist options
  • Save KyleJamesWalker/11ae86c1a0d5151a4401ce295c9ac434 to your computer and use it in GitHub Desktop.
Save KyleJamesWalker/11ae86c1a0d5151a4401ce295c9ac434 to your computer and use it in GitHub Desktop.
Filter Long Descriptions from LastPass Export for BitWarden Import

Overview

When trying to import my LastPass passwords, I had many that were over 1000 characters for the notes, so this script simply filters out the values that are likely too long.

Once this has been run you will have 2 files, one that can be imported, and the other can be edited, or broken up to allow the remaining import.

import csv
def main():
csvfile_good = open('lastpass_good.csv', 'w', newline='')
csvfile_bad = open('lastpass_bad.csv', 'w', newline='')
with open("lastpass_export.csv", "r") as fp:
reader = csv.DictReader(fp)
fieldnames = reader.fieldnames
good = csv.DictWriter(csvfile_good, fieldnames=fieldnames)
bad = csv.DictWriter(csvfile_bad, fieldnames=fieldnames)
good.writeheader()
bad.writeheader()
for row in reader:
if len(row["extra"]) > 750:
bad.writerow(row)
else:
good.writerow(row)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment