Skip to content

Auto-detect CSV format when --csv-delimiter is specified #2831

@dennisangemi

Description

@dennisangemi

Problem Description

Currently, when using --csv-delimiter with a non-default delimiter (e.g., semicolon), VisiData doesn't automatically recognize the file as CSV format. This results in:

  1. "unknown filetype" message for files without .csv extension
  2. File opened as plain text instead of CSV
  3. User must manually specify -f csv in addition to --csv-delimiter

Current Behavior

# This shows "unknown filetype" and opens as text
echo "Name;Age;City
John;25;New York
Alice;30;London" | vd --csv-delimiter ";" -
Image
# User must specify both flags
echo "Name;Age;City
John;25;New York  
Alice;30;London" | vd --csv-delimiter ";" -f csv -
Image

Expected Behavior

When --csv-delimiter is specified with a non-default value, VisiData should automatically assume CSV format without requiring the -f csv flag.

Use Case

This is particularly useful for:

  • CSV files using semicolons as delimiters
  • Data files without .csv extension but with CSV structure
  • Simplified command-line usage when working with non-comma CSV data

Environment

VisiData version: 3.2+
Files affected: Any text file with CSV structure using non-comma delimiters

Pull request

I'm opening a pull request to implement this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions