# How to Export Holehe Results to CSV: Complete CLI and Python Guide

> Easily export Holehe results to CSV. Learn the simple CLI flag and Python function to save your email OSINT data efficiently.

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

---

**Holehe supports exporting email OSINT results directly to CSV using the `-C` or `--csv` command-line flag, or programmatically via the `export_csv` function in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py).**

Holehe is an open-source email reconnaissance tool developed by megadose that checks for account registrations across hundreds of platforms. When conducting investigations, you often need to archive results in a structured format for reporting or further analysis. According to the Holehe source code, the CSV export functionality is implemented natively and requires no external dependencies beyond the standard library.

## How the CSV Export Function Works

The CSV export logic resides in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) within the **`export_csv`** function (lines 154–165). This method accepts the collected results, an arguments namespace, and the target email address to generate a timestamped output file.

The function reads the list of dictionaries returned by the modules and writes them to a file named `holehe_<timestamp>_<email>_results.csv`. The header row is dynamically generated from the keys of the first result dictionary, ensuring all fields—**`name`**, **`exists`**, **`emailrecovery`**, **`phoneNumber`**, and **`others`**—are preserved in the output.

The command-line interface exposes this functionality through a boolean flag defined in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) (lines 190–193):
- `-C` (short form)
- `--csv` (long form)

When either flag is present, the program automatically invokes `export_csv(out, args, email)` after all modules complete execution.

## Command-Line CSV Export

The simplest method to export Holehe results to CSV is using the built-in CLI flag. This approach requires no scripting and deposits the file in your current working directory.

```bash

# Export results for a single email to CSV

holehe test@example.com --csv

# Alternative short syntax

holehe test@example.com -C

```

Upon completion, Holehe creates a timestamped file following this pattern:

```text
holehe_1724592000_test@example.com_results.csv

```

The UNIX timestamp ensures unique filenames when running multiple scans against the same target.

## Programmatic CSV Export in Python

For integration into larger workflows or custom OSINT pipelines, you can invoke the CSV export directly from Python without spawning a subprocess. The `export_csv` function is importable from [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py), but requires a namespace object mimicking the CLI arguments.

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

async def run_investigation(email):
    out = []
    async with httpx.AsyncClient() as client:
        # Execute any combination of modules

        await twitter(email, client, out)
        # Add more modules as needed...

    
    # Create a mock args namespace to satisfy export_csv requirements

    class Args:
        csvoutput = True
    
    # Export to CSV file

    export_csv(out, Args(), email)

# Execute the async workflow

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

```

This method gives you fine-grained control over which modules execute while still leveraging the official CSV serialization logic. The `Args` class must include the **`csvoutput`** attribute set to `True` to trigger the file write operation.

## CSV Output Structure

The generated CSV file contains one row per module executed, with columns mapped to the dictionary keys returned by each module's analysis function. Standard fields include:

- **`name`** — The service or platform checked (e.g., "twitter", "instagram")
- **`exists`** — Boolean indicating whether the email is registered
- **`emailrecovery`** — Partial recovery email if exposed by the platform
- **`phoneNumber`** — Partial phone number if exposed
- **`others`** — Additional metadata returned by the specific module

The output preserves the raw data structure, making it compatible with pandas, Excel, or SIEM ingestion pipelines.

## Summary

- **Location**: The CSV export functionality is implemented in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) via the `export_csv` function (lines 154–165) and the `-C/--csv` CLI flag (lines 190–193).
- **CLI Usage**: Append `--csv` or `-C` to any Holehe command to automatically generate a timestamped CSV file.
- **Filename Format**: `holehe_<timestamp>_<email>_results.csv` ensures unique outputs per execution.
- **Python API**: Import `export_csv` from `holehe.core` and supply a mock `Args` object with `csvoutput=True` to export programmatically.
- **Data Fields**: Exports include `name`, `exists`, `emailrecovery`, `phoneNumber`, and `others` for each checked service.

## Frequently Asked Questions

### What file name format does Holehe use for CSV exports?

Holehe generates filenames using the pattern `holehe_<timestamp>_<email>_results.csv`, where `<timestamp>` is a UNIX timestamp and `<email>` is the target address. This naming convention prevents overwrites when scanning the same email multiple times and ensures chronological sorting in file explorers.

### Can I export Holehe results to CSV from Python without using the CLI?

Yes. Import the `export_csv` function from [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) and call it with your results list, a namespace object containing `csvoutput=True`, and the target email. This approach is essential when building custom async workflows that bypass the standard command-line entry point.

### What data fields are included in the Holehe CSV export?

The CSV contains columns derived from the module response dictionaries, specifically: **`name`** (service identifier), **`exists`** (registration status), **`emailrecovery`** (recovery email fragments), **`phoneNumber`** (phone fragments), and **`others`** (platform-specific metadata). The header row is generated dynamically from the first result's keys.

### Where is the CSV export function implemented in the Holehe source code?

The export logic is located in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) at lines 154–165, within the `export_csv` function. The CLI argument parser that enables the feature is defined at lines 190–193 in the same file, adding the `-C` and `--csv` flags to the argument namespace.