# How to Export Holehe Results to CSV

> Export Holehe results to CSV easily using the --csv flag or holehe core.py. Streamline your data analysis with this simple guide.

- Repository: [Palenath/holehe](https://github.com/megadose/holehe)
- Tags: how-to-guide
- Published: 2026-08-27

---

**Holehe exports investigation results to CSV via the `-C/--csv` command-line flag or by calling the `export_csv` function directly from [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py).**

Holehe is an open-source email investigation tool by megadose that checks if an email address is registered on various websites. When running investigations, you can export Holehe results to CSV format for easy analysis, reporting, and integration with other data processing workflows.

## Using the Command-Line CSV Flag

The fastest way to export Holehe results to CSV is through the built-in CLI option. In [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py), the argument parser defines a boolean flag **`-C/--csv`** at lines 190‑193 that triggers the export functionality.

When you include this flag, Holehe automatically invokes the **`export_csv`** function (implemented at lines 154‑165) after all modules finish executing. The function writes the compiled results to a file named `holehe_<timestamp>_<email>_results.csv` in your current working directory.

```bash

# Export results for test@example.com to CSV

holehe test@example.com --csv

# Short form

holehe test@example.com -C

```

The generated CSV includes a header row derived from the keys of the first result dictionary, with one row per module containing fields such as `name`, `exists`, `emailrecovery`, `phoneNumber`, and `others`.

## Programmatic CSV Export in Python

For custom workflows and automation scripts, import the **`export_csv`** function directly from [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) and invoke it after running your selected modules.

### Mimicking CLI Arguments

When calling Holehe modules asynchronously, accumulate results in a list and pass them to `export_csv` along with a namespace object containing `csvoutput = True`:

```python
import httpx, trio
from holehe.core import export_csv
from holehe.modules.social_media.twitter import twitter

async def run(email):
    out = []
    async with httpx.AsyncClient() as client:
        await twitter(email, client, out)
    
    # Create a mock argparse namespace to enable CSV output

    class Args:
        csvoutput = True
    
    export_csv(out, Args(), email)

trio.run(run, "test@example.com")

```

This approach creates the same timestamped CSV file without invoking the command-line interface, allowing you to integrate Holehe into larger Python applications.

## Understanding the CSV Output Structure

The CSV file generated by Holehe follows a standardized schema based on the investigation metadata. According to the implementation in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py), the `export_csv` function extracts the keys from the first result dictionary to create the header row, ensuring all subsequent module results align to the same columns.

Standard fields typically include:

- **name** – The service or website checked (e.g., twitter, instagram)
- **exists** – Boolean indicating if the email is registered on the platform
- **emailrecovery** – Recovery email address if exposed by the service
- **phoneNumber** – Associated phone number if leaked during the check
- **others** – Additional metadata or rate-limiting information from the module

## Summary

- Use the **`-C` or `--csv`** flag in the CLI to automatically save results to a timestamped CSV file named `holehe_<timestamp>_<email>_results.csv`
- The **`export_csv`** function in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) (lines 154‑165) handles the file writing logic using Python’s `csv.DictWriter`
- Programmatic users can import `export_csv` and pass a list of result dictionaries with a mock arguments object containing `csvoutput = True`
- Output columns dynamically map to result keys including `name`, `exists`, `emailrecovery`, `phoneNumber`, and `others`
- The entry point wiring in [`holehe/__init__.py`](https://github.com/megadose/holehe/blob/main/holehe/__init__.py) and [`setup.py`](https://github.com/megadose/holehe/blob/main/setup.py) connects the CLI flags to the core export functionality

## Frequently Asked Questions

### Where does Holehe save the CSV file?

Holehe saves the CSV file in the current working directory where you execute the command. The filename follows the pattern `holehe_<timestamp>_<email>_results.csv`, making it easy to identify when the investigation occurred and which email address was checked.

### Can I export to CSV when using Holehe as a Python library?

Yes. Import the `export_csv` function from [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) and call it after your module execution loop. You must provide a mock arguments object with `csvoutput = True` to trigger the file write, as the function checks this attribute before writing.

### What columns are included in the Holehe CSV export?

The CSV contains columns derived from the result dictionary keys, typically including `name` (service name), `exists` (registration status), `emailrecovery` (recovery email), `phoneNumber` (leaked phone), and `others` (miscellaneous data). The `export_csv` function uses the first result's keys to generate the header row dynamically.

### Is the CSV export feature available in all Holehe versions?

The CSV export functionality is implemented in the current master branch of megadose/holehe within [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py). Ensure you have the latest version installed from the repository to access the `-C/--csv` CLI flags and the `export_csv` function.