How to Export Holehe Results to CSV: Complete Guide with CLI and Python Examples
Use the --csv (or -C) flag when running Holehe to automatically generate a timestamped CSV file containing all scan results.
Holehe is an open-source email enumeration tool that checks for account registrations across hundreds of websites. When you need to analyze or archive these findings, exporting to CSV is essential for spreadsheet analysis, reporting, or integration with other tools. According to the megadose/holehe source code, CSV export is built directly into the command-line interface.
Using the --csv Flag for Command-Line Export
The simplest way to export Holehe results to CSV is via the dedicated command-line flag. This functionality is implemented in holehe/core.py at lines 92–94, where the argument parser adds the --csv option.
Basic CSV Export Syntax
holehe --csv user@example.com
Or use the short form:
holehe -C user@example.com
Combining CSV Export with Other Options
The -C flag works alongside all other Holehe options:
# Export only services where the email is found to be in use
holehe --only-used -C user@example.com
# Export with verbose output
holehe -v --csv user@example.com
When execution completes, Holehe creates a file named holehe_<unix-timestamp>_<email>_results.csv in your current working directory. For example: holehe_1728001234_user@example.com_results.csv.
Understanding the CSV Export Implementation
The export_csv function in holehe/core.py (lines 54–65) handles the actual file creation and data writing. This function preserves all fields returned by each service module, ensuring no data is lost during export.
Exported Fields Include
- domain — The service or website checked
- exists — Boolean indicating if the account exists
- emailrecovery — Recovery email if exposed
- phoneNumber — Associated phone number if exposed
- others — Additional metadata from the specific module
Each service checked generates one row in the CSV, creating a complete dataset for further analysis.
Programmatic CSV Export in Python
For developers embedding Holehe into larger workflows, you can invoke the same export routine directly from Python without shelling out to the CLI.
Direct Function Call
from holehe.core import export_csv
# results: list of dicts returned by the scanning process
# args: argparse.Namespace with csvoutput=True
# email: target email address as string
export_csv(results, args, email)
Practical Integration Example
import argparse
from holehe.core import export_csv, main as holehe_main
def scan_and_export(email):
# Perform scan
results = holehe_main(email, verbose=False)
# Prepare args namespace for CSV export
args = argparse.Namespace(csvoutput=True)
# Generate CSV file
export_csv(results, args, email)
print(f"Results exported for {email}")
scan_and_export("target@example.com")
This approach gives you full control over the scanning process while maintaining consistent CSV output formatting.
Key Source Files for CSV Functionality
| File | Lines | Purpose |
|---|---|---|
holehe/core.py |
54–65 | export_csv() function — handles CSV file creation and row writing |
holehe/core.py |
92–94 | Argument parser — defines --csv / -C CLI flags |
Summary
- Command-line: Append
-Cor--csvto any Holehe command to generate a timestamped CSV file automatically - Output location: Current working directory with filename pattern
holehe_<timestamp>_<email>_results.csv - Data completeness: All module-returned fields (
domain,exists,emailrecovery,phoneNumber, etc.) are preserved - Programmatic access: Import and call
export_csv()fromholehe.corefor Python-native workflows
Frequently Asked Questions
Does the CSV export include services where no account was found?
Yes. The CSV contains one row per service checked, with the exists field indicating True or False. This gives you a complete audit trail of all tested platforms.
Can I specify a custom filename or output directory for the CSV?
No. The export_csv function in holehe/core.py automatically generates timestamped filenames in the current working directory. To organize outputs, change to your desired directory before running Holehe, or move/rename files post-execution.
What happens if I run Holehe multiple times with the same email?
Each execution creates a distinct CSV file with its own Unix timestamp. Previous files are never overwritten, allowing you to track changes in account status over time by comparing timestamps.
Is the CSV format compatible with Excel and Google Sheets?
Yes. The export uses standard CSV formatting with comma delimiters. All major spreadsheet applications open these files without additional configuration.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →