csvlang is a dynamic language to interact with CSV files. It is a domain-specific language that allows you to read, filter, modify, and export data from CSV files easily.
Documentation about csvlang commands can be found at godoc.org.
load data.csv
let rows = read row *;
let firstRow = read row 0;
let firstColumn = read row * col 0;
let filteredRows = read row * col * where age > 20;
load data.csv
let rows = read row * col amount where age > 20;
let polyfilledRows = fill(rows, "name", "John Doe");
load data.csv
let rows = read row *;
let uniqueRows = unique(rows);
To calculate the sum, average, and count of values in a column.
load data.csv
let rows = read row * col amount where age > 20;
let totalAmount = sum(rows);
let averageAmount = avg(rows);
let countAmount = count(rows);
load data.csv
let rows = read row * where age > 20;
save rows as output.csv;
save rows as output.json;
go install github.com/Rishabh570/csvlang@latest- Download the latest binary for your platform from the releases page.
- Extract the archive.
- Add the binary to your PATH.
git clone https://github.com/Rishabh570/csvlang.git
cd csvlang
go build -o csvlang- Clone the project:
git clone https://github.com/Rishabh570/csvlang- Change to the project directory:
cd csvlang- Install the dependencies:
go mod tidy- Create a CSV file named
data.csvin the project directory with the following content:
name,age,amount
John Doe,25,1000
John Doe,25,1000
Jane Smith,30,2000
Bob Brown,28,2500
- Create a csvlang script named
script.csvlangin the project directory with the following content:
load data.csv
let rows = read row * where age > 20;
let uniqueRows = unique(rows);
save uniqueRows as output.csv;
- Run the project with your csvlang script path:
go run main.go --path <path-to-csvlang-script>or, if you have installed the binary and it is present in your PATH, you can run the following command:
csvlang --path <path-to-csvlang-script>To run tests, run the following command
go test ./...Contributions are always welcome!
See contributing.md for ways to get started.