Somacon.com: Articles on websites & etc.

§ Home > Index > General Interest

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:

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.

Import Instructions

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.

  1. Open your passwords spreadsheet and set up the following column headers:
    Account, Login Name, Password, Web Site, Comments
  2. Arrange your data under the above column headings as needed.
  3. In the empty column F, row 1, enter the following formula:
  4. 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.
  5. 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.)
  6. 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".
  7. Rename the file to have a ".csv" file extension.
  8. Open Keepass, choose "File > Import" from the menu.
  9. 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.


Have you heard of the new, free Automated Feeds offered by Google Merchant Center? Learn more in Aten Software's latest blog post comparing them to traditional data feed files.
Created 2010-10-29, Last Modified 2016-12-01, © Shailesh N. Humbad
Disclaimer: This content is provided as-is. The information may be incorrect.