Skip to main content

Export pass(1), "the standard unix password manager", to CSV

Project description


Source is available at GitHub.

You can install it directly from PyPI with pip:

python3 -m pip install --user pass2csv


$ pass2csv --help
usage: pass2csv [-h] [-a] [-b GPGBINARY] [-x] [-l LOGIN_FIELDS [LOGIN_FIELDS ...]] [-u]
                [-e EXCLUDE_ROWS [EXCLUDE_ROWS ...]]

positional arguments:
  path                  path to the password-store folder to export

optional arguments:
  -h, --help            show this help message and exit
  -a, --agent           ask gpg to use its auth agent
  -b GPGBINARY, --gpgbinary GPGBINARY
                        path to the gpg binary you wish to use
  -x, --kpx             format the CSV for KeePassXC
                        strings to interpret as names of login fields (only used with -x)
  -u, --get-url         match row starting with 'url:' and extract it (only used with -x)
                        regexps to exclude from the notes field (only used with -x)

Export format

There are two ways to export CSV data:

  1. The format for the KeePass Generic CSV Importer:


    Where 'Password' is the first line of the entry in pass and 'Notes' are all subsequent lines. '\' should not be interpreted as an escape character.

    This is the default mode.

  2. The format for the KeePassXC Importer:


    Where 'Password' is the first line of the entry in pass, 'User' is configured with -l, URL is extracted if -u is set, and 'Notes' contains any other fields that do not match -e.

    'User' field is chosen by searching for the first field with a name set by -l. Once the field is found, the login is set and the field is removed from notes.

    Use -x or --kpx to enable this mode.

Example KeePassXC Import

  • Cmd line

      pass2csv ~/.password-store -x -l username login email -u -e '^---$'
  • Password entry (sites/example)

      username: user_name
  • Output CSV row (formatted)

      sites, example, user_name, password123,, "email:\nsome_note"
  • user_name was chosen because username was the first argument to -l.

  • Both login and URL fields were excluded from the notes field because they were used in another field.

  • --- Was not included in the notes field because it was matched by -e.

Example KeePass Generic CSV Importer

  • Cmd line

      pass2csv ~/.password-store
  • Password entry: Same as above

  • Output CSV row (formatted)

      sites, example, password123, "---\nusername: user_name\nemail:\nurl:\nsome_note"


Create a virtual environment:

python3 -m venv venv

Activate the environment:

. venv/bin/activate

Now you may either use pip directly to install the dependencies, or you can install pip-tools. The latter is recommended.


pip install -r requirements.txt


pip-tools can keep your virtual environment in sync with the requirements.txt file, as well as compiling a new requirements.txt when adding/removing a dependency in

It is recommended that pip-tools is installed within the virtual environment.

pip install pip-tools
pip-compile  # only necessary when adding/removing a dependency

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pass2csv-0.1.3.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

pass2csv-0.1.3-py3-none-any.whl (5.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page