Skip to main content

A command-line tool for viewing CSV files with aligned columns

Project description

ViewCSV

A command-line tool for viewing CSV files with aligned columns. It makes CSV files easier to read in the terminal.

Features

  • Smart column width adjustment based on content statistics
  • Intelligent text wrapping for long content
  • Cross-platform compatibility (Windows, Linux, macOS)
  • Header row highlighting with separator lines
  • Supports CJK (Chinese, Japanese, Korean) characters
  • Automatic encoding detection (UTF-8 and Windows CP1252)
  • Handles irregular CSV files (varying column counts)
  • Configurable display options

Installation

pip install viewcsv

Usage

viewcsv data.csv                        # View entire CSV file
viewcsv data.csv -n 10                  # View first 10 rows
viewcsv data.csv --no-header            # View without header row
viewcsv data.csv --width-multiplier 1.5 # Adjust column width threshold

Advanced Options

  • --width-multiplier: Controls column width threshold (default: 2.0)
    • Lower values (e.g., 1.5) create narrower columns with more text wrapping
    • Higher values (e.g., 3.0) allow wider columns with less wrapping
    • Based on the average width of content in each column

Examples

Input CSV:

Name,Age,City,Description
John Smith,25,New York,Software engineer
张三,30,Beijing,数据科学家和机器学习专家
Maria García,28,Madrid,¡Desarrolladora de aplicaciones móviles!
Александр,35,Moscow,Специалист по анализу данных
김영희,27,Seoul,프로그래머 & 개발자
中村 悠太,31,Tokyo,システムエンジニア・プログラマー
Lars Müller,29,Berlin,Software-Entwickler & IT-Berater
Sophie Martin,26,Paris,Ingénieure en intelligence artificielle
王小明,33,Shanghai,高级工程师(全栈开发)〜通信系统
山田花子,28,Osaka,データサイエンティスト&機械学習専門家
Elena Popov,31,St. Petersburg,Веб-разработчик и UX-дизайнер
李四,29,Guangzhou,全栈工程师・DevOps专家…续
Sarah Williams,27,London,This is another very very very long description that will definitely need to be wrapped into multiple lines to maintain readable formatting
洪大同,31,Taipei,資深軟體工程師(後端開發)
박지민,25,Busan,풀스택 개발자 & 소프트웨어 아키텍트

Output:

Name           | Age | City          | Description
---------------------------------------------------------------------------------------------------------------
John Smith     | 25  | New York      | Software engineer
张三            | 30  | Beijing       | 数据科学家和机器学习专家
Maria García   | 28  | Madrid        | ¡Desarrolladora de aplicaciones móviles!
Александр      | 35  | Moscow        | Специалист по анализу данных
김영희          | 27  | Seoul         | 프로그래머 & 개발자
中村 悠太       | 31  | Tokyo         | システムエンジニア・プログラマー
Lars Müller    | 29  | Berlin        | Software-Entwickler & IT-Berater
Sophie Martin  | 26  | Paris         | Ingénieure en intelligence artificielle
王小明          | 33  | Shanghai      | 高级工程师(全栈开发)〜通信系统
山田花子        | 28  | Osaka         | データサイエンティスト&機械学習専門家
Elena Popov    | 31  | St. Petersbur | Веб-разработчик и UX-дизайнер
                       g
李四           | 29  | Guangzhou     | 全栈工程师・DevOps专家…续
Sarah Williams | 27  | London        | This is another very very very long description that will definitely n
                                       eed to be wrapped into multiple lines to maintain readable formatting
洪大同         | 31  | Taipei        | 資深軟體工程師(後端開發)
박지민         | 25  | Busan         | 풀스택 개발자 & 소프트웨어 아키텍트

Requirements

  • Python 3.7 or higher
  • No external dependencies required

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

viewcsv-1.1.0.tar.gz (46.2 kB view details)

Uploaded Source

Built Distribution

viewcsv-1.1.0-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

Details for the file viewcsv-1.1.0.tar.gz.

File metadata

  • Download URL: viewcsv-1.1.0.tar.gz
  • Upload date:
  • Size: 46.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for viewcsv-1.1.0.tar.gz
Algorithm Hash digest
SHA256 03d33b900ba5aba2237a0f6cd9eebc9cf2e8ccd16a197f9f6d26d1808926a0b5
MD5 eaf3b1cca283a58ffd90828e3f55384f
BLAKE2b-256 7ca3e57cea4c93fa64e4630527388d146cf334c01c93b883ffb1161a6932b041

See more details on using hashes here.

File details

Details for the file viewcsv-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: viewcsv-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 32.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for viewcsv-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1bab82a6c323e64ad5f08cfeed04010ed04884e9889efc190a754de7c94410e5
MD5 3772a57a533ddee8b0fd0da5f439b5c3
BLAKE2b-256 5c97e66a94b365c673605b4dab4ec208d8a78086b6bd1c9c161296d9c7342b17

See more details on using hashes here.

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