KeePass Import CSV File How To
Instructions for using Excel to import CSV password files into KeePass 2.x.
KeePass is a fantastic, freeware password manager. It is also open-source, making it more secure (you can build it yourself). Unfortunately, importing passwords from Excel or CSV files can be problematic. You may receive the error Found invalid data while decoding if the format is invalid. This assumes you are importing using the "KeePass CSV (1.x)" import format. See File Format CSV Import Help for more information. Here are some tips:
- Every value must be enclosed in double quotes. This includes blanks, numbers, and multi-line values.
- The file must be saved as UTF-8 (or ANSI).
- Double quotes must be escaped with with a backslash, like
- Back-slashes must be escaped with with another backslash, like
Microsoft Excel 2002 can not, by default, produce a file following the above format. Excel does not normally enclose blank fields or numbers in quotes. You also can not copy values out of Excel in the above format. When you copy a value out of Excel that has multiple lines, then Excel adds double-quotes around the value and doubles each double-quote automatically. These issues will cause problems importing multi-line comments and double-quotes via Keepass CSV Import.
The technique below will allow you to use Excel and Word together to generate the correctly formatted CSV file. The Excel formula provided below will generate the correct CSV format. Then, you copy and paste the results into Word and save as a plain text file. This ensures the correct formatting.
- Open your passwords spreadsheet and set up the following column headers:
Account, Login Name, Password, Web Site, Comments
- Arrange your data under the above column headings as needed.
- In the empty column F, row 1, enter the following formula:
- Drag the bottom-right corner of the selection marquee down to the end of the password list to repeat the formula for every row with a record.
- Now all the cells in that column should be highlighted, so simply copy the cells and paste into a blank Microsoft Word document. (Do not paste into a plain text editor, otherwise, Excel will insert unwanted double-quotes on lines with multi-line values.)
- Save the Microsoft Word document as Plain text (.txt). If Word prompts you for save options, choose Unicode (UTF-8) as the encoding. Leave "Insert line breaks" and "Allow character substitution" unchecked, and "End lines with" as "CR/LF".
- Rename the file to have a ".csv" file extension.
- Open Keepass, choose "File > Import" from the menu.
- Select "Keepass CSV 1.x" as the Format, choose the file to be imported, and click OK.
Your passwords should now be imported without errors!
Using OpenOffice Calc
With minor modification to the formula, you can also use the freeware OpenOffice Calc. With Calc, you do not need to save the formula results via a word processor. You can simply copy column F and paste it into any text editor (such as notepad, Textpad, or UltraEdit). Save the file as a
.csv file, and it will be already correctly formatted and ready to be imported.
For your convenience, I have listed the OpenOffice Calc formula to generate a Keepass version 1.x CSV import file below:
If you enjoyed this article, please link to it from your blog or website.
Disclaimer: This content is provided as-is. The information may be incorrect.