Importing CSV into specific folder in Keepass

0

I had been using Lastpass but found Keepass more suitable for my needs. Before deleting my Lastpass account, I exported to a CSV file. I know in Keepass you can import the CSV file, but I'm wondering, is there a way to have it imported so it goes into a specfic folder (titled "From Lastpass"). This is an issue because there will be some duplicate entries, for example I saved my Gmail password in both Keepass and Lastpass.

As requested, here is a sample from the CSV file (with sensitive information changed). If relevant the first couple lines of the CSV are blank.

url,username,password,extra,name,grouping,fav
https://account.live.com/password/reset?mkt=en-us&uiflavor=web,6421875,$some@#F6nonsense$,,Hotmail,,0
https://www.facebook.com/?stype=lo&jlou=Afc23FA4cR4kFqZlHCb58SS2YRKX_z-Essmuh=12361&lh=Ac9CVr7ZNgWgihys&aik=M9Qq2pL3lzagTAA,my_email_address@hotmail.com,secret!password123,,Facebook,(none),0
https://login.yahoo.com/config/login_verify2?.intl=ca&.src=ym,my_yahoo@yahoo.com,af!@Ra#w12,,Yahoo mail,(none),0
https://www.evernote.com,,Pa$$w0rd3@,,Evernote,,0

Celeritas

Posted 2016-12-27T02:15:42.203

Reputation: 7 487

Answers

1

Since a CSV file is a plain text file, you can edit it prior to importing in KeePass. The idea is to modify the CSV by typing in the target folder (called Group in KeePass) you want, then import it.

Keepass supports a Group field, which represent folders. Keepass also supports specifying subgroups which will translate into subfolders, so if the LastPast CSV has a group/folder column already and you'd like to retain your LastPass categories as subfolders, you can prepend LastPass\ in front of each group entries (or LastPass\\ if you need to use the escape backslash option).

A good way to edit a CSV is to open it in Excel, use the "Text to columns" function to separate columns by comma, leaving all fields as "Text" type, modify the column that represents the group, then save it back as a CSV file.

I recommend making a backup copy of your CSV and your Keepass KBDX files before doing this, just in case.

Links:

Detailed procedure (Manual)

As you can see in the first line of your CSV, the Grouping column is the penultimate one. I typed From LastPass before the last comma in each line:

url,username,password,extra,name,grouping,fav
https://account.live.com/password/reset?mkt=en-us&uiflavor=web,6421875,$some@#F6nonsense$,,Hotmail,From LastPass,0
https://www.facebook.com/?stype=lo&jlou=Afc23FA4cR4kFqZlHCb58SS2YRKX_z-Essmuh=12361&lh=Ac9CVr7ZNgWgihys&aik=M9Qq2pL3lzagTAA,my_email_address@hotmail.com,secret!password123,,Facebook,From LastPass,0
https://login.yahoo.com/config/login_verify2?.intl=ca&.src=ym,my_yahoo@yahoo.com,af!@Ra#w12,,Yahoo mail,From LastPass,0
https://www.evernote.com,,Pa$$w0rd3@,,Evernote,From LastPass,0

Then imported into KeePass:

Import Import 2 Results

All entries were imported in the From LastPass folder, which I believe was your question.

Detailed procedure (Excel)

If you don't want to do it by hand for each line, here's how to do it all at once in Excel:

  1. Open the CSV file in Excel by choosing "Text files" in the open dialog. enter image description here
  2. You will likely see this. Select the entire column A, then in the Data menu click Text to Columns to open up the wizard. enter image description here
  3. Choose Delimited enter image description here
  4. Select only Comma as the delimiter enter image description here
  5. Select all columns in the bottom preview (scroll right and shift+click on the last column header), and choose Text as the data format. This is to tell Excel not to try to treat the information as numbers or dates, which could end up removing leading zeros and so on. enter image description here
  6. The data should now be in a spreadsheet format like this. Note the grouping column. enter image description here
  7. Type in the folder name you want, and copy paste it on all rows. enter image description here
  8. File..Save As to open the save dialog. Make sure to choose CSV as the type. enter image description here

The import in the same way as the manual steps above. With your sample data, both the manual and the Excel method gave the same results using KeePass 2.34.

mtone

Posted 2016-12-27T02:15:42.203

Reputation: 11 230

I'm having a bit of trouble following the directions. So you're saying to import the LastPass CSV file as a generic CSV file into Keepass? In which field are you saying to type LastPass\ in? You do understand I want all of the LastPass passwords to be stored in their own folder in Keepass? Also I don't understand why you're talking about Excel. – Celeritas – 2016-12-27T04:58:37.403

@Celeritas Granted, my answer is a bit generic. One reason is that I don't own a LastPass account so I don't know exactly what the CSV looks like. If you want to copy-paste 2 samples lines from your CSV in your question (with fake credentials), I can try to provide more detailed instructions. I mentionned Excel because a CSV is basically a type of spreadsheet, but if you open the CSV in notepad you should see all your info in condensed form. The idea is to modify the CSV by typing in the target folder (aka Group) you want, then import it. – mtone – 2016-12-27T19:42:35.500

Ok, I updated question with example. – Celeritas – 2016-12-27T21:57:00.867

@Celeritas Answer updated with step by step and screenshots. Hopefully you will find what you need there. Excel is just one way to edit CSV files to try to save time if you have lots of entries, there are others good methods I'm sure. – mtone – 2016-12-28T03:45:41.270