This Python script merges multiple CSV files by appending rows to a single output CSV file. The script also processes each row to reformat the date and filter the columns before merging.
- Python 3.6 or later
- Clone this repository or download the script
csv_merger.py
. - Make sure you have Python installed, or download it from Python's official website.
Open a terminal and navigate to the directory containing the script. Then, run the following command:
python csv_merger.py [OPTIONS]
-n, --name [FILENAME]
: Specifies the name of the output file (default:merged.csv
).-d, --delete
: Deletes input files after merging (default: False).
Let's say you have a directory input
with the following CSV files:
file1.csv
file2.csv
After running the command:
python csv_merger.py -n "final_version" -d
An output file named final_version.csv
will be created in the ouput directory, and the input files will be deleted if the -d
flag is set.
For contributing to this project, please feel free to open an issue or submit a pull request.
- Website carlos8a.com
- GitHub @CarlosUlisesOchoa
- X @Carlos8aDev