https://github.com/raphico/csv-data-transformer
a cli tool for transforming and working with csv files
https://github.com/raphico/csv-data-transformer
cli-app fs minimist nodejs stream vitest
Last synced: 7 months ago
JSON representation
a cli tool for transforming and working with csv files
- Host: GitHub
- URL: https://github.com/raphico/csv-data-transformer
- Owner: Raphico
- License: mit
- Created: 2024-11-06T11:45:16.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-12-06T21:26:23.000Z (11 months ago)
- Last Synced: 2025-01-19T12:14:26.819Z (9 months ago)
- Topics: cli-app, fs, minimist, nodejs, stream, vitest
- Language: JavaScript
- Homepage:
- Size: 42 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CSV Data Transformer
A Node.js CLI tool for transforming and processing large CSV files. Supports filtering, aggregating, and modifying CSV data efficiently using streams. Ideal for processing data in various formats, cleaning, and preparing it for further use.
## Features
- **Filter rows** based on column values.
- **Aggregate data** (e.g., sum, average) by specific columns.
- **Add, remove, or rename columns.**
- **Export** to CSV or JSON formats.## Installation
1. clone repository
```bash
git clone git@github.com:Raphico/csv-data-transformer.git
cd csv-data-transformer
```2. install dependencies
```bash
npm install
```3. create symlink
```bash
npm link
```## Usage
```bash
csvtransform --help
```## Commands
| Command | Description | Example |
| ---------------------------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `--input ` | Specifies the CSV file to process. | `--input data.csv` |
| `--output ` | Specifies the output file path and format (`.csv` or `.json`). | `--output result.json` |
| `--filter ` | Filters rows based on a condition (e.g., `column=value`). | `--filter "status=active", --filter "status=active OR country=USA", --filter "status=active AND country=USA` |
| `--aggregate ` | Aggregates data, e.g., `sum`, `average` on a column. | `--aggregate "sum,sales"` |
| `--add-column ` | Adds a new column with a default value. | `--add-column "discount=0"` |
| `--remove-column ` | Removes a specified column. | `--remove-column "old_column"` |
| `--rename-column ` | Renames a column. | `--rename-column "old_col=new_col"` |
| `--delimiter ` | Specifies the CSV delimiter (default is a comma). | `--delimiter ";"` |