The csv2api parser reads the CSV file with the raw data, filters the records, identifies fields to be changed, and sends a request to update the data to the specified endpoint of your REST API.
All actions take place according to the settings in the configuration file.
Features:
First, download and install Go. Version 1.20
(or higher) is required.
Installation is done by using the go install
command:
go install github.com/koddr/csv2api@latest
π‘ Note: See the repository's Release page, if you want to download a ready-made
deb
,rpm
,apk
orArch Linux
package.
GNU/Linux and macOS users available way to install via Homebrew:
# Tap a new formula: brew tap koddr/tap # Installation: brew install koddr/tap/csv2api
Next, run csv2api
with -i
option to generate initial config.yml
and data.csv
files in the current dir:
Prepare your config and input data files:
config.yml
:
columns_order
section is a primary key (PK) for your process.api
section.filter_columns
section.update_fields
section.data.csv
:
π‘ Note: See the repository's Wiki page to understand the structure of the config and input data files.
And now, run csv2api
with options:
csv2api \ -c /path/to/config.yml \ -d /path/to/data.csv \ -e CONFIG
Done! π Your transactions have been performed:
Hello and welcome to csv2api! π β According to the settings in './config.yml', 5 transactions were filtered out of 10 to start the process. β Only 3 transactions got into the final set of actions to be taken... Please wait! β Field 'tags' with values '[paid]' in the transaction '2' has been successfully updated (HTTP 200) β Field 'tags' with values '[paid]' in the transaction '8' has been successfully updated (HTTP 200) β Field 'tags' with values '[paid]' in the transaction '10' has been successfully updated (HTTP 200) β Saving filtered transactions to CSV file './filtered-1686993960.csv' in the current dir... OK! All done! π Time elapsed: 0.11sπ³ Docker-way to quick start
If you don't want to physically install csv2api
to your system, you feel free to using our official Docker image and run it from isolated container:
docker run --rm -it -v ${PWD}:${PWD} -w ${PWD} koddr/csv2api:latest [OPTIONS]Option Description Is required? Default value
-i
set to generate initial config (config.yaml
) and example data (data.csv
) files no false
-c
set path to your config file yes ""
-d
set path to your CSV file with input data yes ""
-e
set prefix used in your environment variables no CONFIG
In my work, I often have to work with large amounts of raw data in CSV format.
Usually it goes like this:
And I'm not talking about the fact that the final REST API (where to send a request with the processed data) do not always have the same parameters for the request body.
To ease this whole process, I created this parser that takes absolutely any data file as input, does the conversions and filtering, and is set up in one single configuration file.
Just prepare the data, set the configuration to your liking, run csv2api
and wait a bit! Yes, it's that simple.
And now, I invite you to participate in this project! Let's work together to create the most useful tool for developers on the web today.
Your PRs & issues are welcome! Thank you π
csv2api
is free and open-source software licensed under the Apache 2.0 License, created and supported with π©΅ for people and robots by Vic ShΓ³stak.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4