Skip to main content

A powerful CLI tool for merging and transforming CSV/XLSX files

Project description

MSV - Merge Source Values

A powerful CLI tool for merging and transforming CSV/XLSX files with natural language support.

Features

  • Merge data from CSV and Excel files
  • Case-sensitive or case-insensitive matching
  • Multiple join types (left, right, outer, inner)
  • Excel sheet support
  • Natural language interface
  • Column mapping with custom names

Installation

pip install msv

Usage

Command Line

msv --source customers.csv --destination orders.csv --match-column email --columns "name,phone"

Natural Language Interface

msv --natural
> merge customers.csv and orders.csv using email column, copy name and phone, ignore case

Options

  • --source, -s: Source file path (.csv or .xlsx)
  • --destination, -d: Destination file path (.csv or .xlsx)
  • --match-column, -m: Column to match between files
  • --columns, -c: Columns to copy (comma-separated)
  • --ignore-case, -i: Ignore case when matching
  • --join: Join type (left, outer, inner)
  • --output, -o: Custom output file path
  • --source-sheet: Sheet name for source Excel file
  • --dest-sheet: Sheet name for destination Excel file
  • --output-sheet: Sheet name for output Excel file (defaults to dest-sheet)

Excel Sheet Support

When working with Excel files (.xlsx), you can specify sheet names:

# Merge specific sheets from Excel files
msv \
  --source users.xlsx \
  --destination accounts.xlsx \
  --match-column email \
  --columns "name,phone" \
  --source-sheet Users \
  --dest-sheet Accounts

# Write to a different output sheet
msv \
  --source data.xlsx \
  --destination report.xlsx \
  --match-column id \
  --columns "value,category" \
  --source-sheet Raw \
  --dest-sheet Current \
  --output-sheet "March 2024"

If no sheet is specified:

  • For source files: Uses the first sheet
  • For destination files: Uses the first sheet or creates "Sheet1"
  • Available sheets are listed when reading Excel files

Configuration

The application supports multiple AI providers for natural language processing. Configure your preferred settings in config.toml:

  1. Copy the example configuration file:
cp config.toml.example config.toml

Development

Requirements

  • Python 3.7+
  • pandas
  • openpyxl

Running Tests

python -m unittest discover tests

License

MIT

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

msv-1.0.3.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

msv-1.0.3-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file msv-1.0.3.tar.gz.

File metadata

  • Download URL: msv-1.0.3.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for msv-1.0.3.tar.gz
Algorithm Hash digest
SHA256 11404ce213da174f306e450be66a42c0106582146163edfb59ada5bd416522d6
MD5 8b35c7b361b5e61f2532e7af3902619a
BLAKE2b-256 b3e825988d062177fedd1b2d7ba0b9cbf622e56f003c1df0c08fb35309e73846

See more details on using hashes here.

File details

Details for the file msv-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: msv-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for msv-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 113085f06fe51a86cc2d1f2eec0836d7ac7c35aebe91876fa00fd1768d767dff
MD5 f3432c131c051876537464b257572b63
BLAKE2b-256 44377cdc0ae62faa319ab5b6ac673167e357215030282f285ada67ab91face18

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