This Python script processes CSV files located in the input folder based on the configuration provided in config.py. It filters rows based on specific criteria and saves the filtered data into the output folder.
-
Configuration:
- Modify
config.pyto specify which columns to include (True) or exclude (False) from the output. - Optionally, set phone number filters in
phone_filter_includeorphone_filter_excludelists.
- Modify
-
Input:
- Place CSV files to be processed in the
inputfolder.
- Place CSV files to be processed in the
-
Output:
- Filtered CSV files will be saved in the
outputfolder.
- Filtered CSV files will be saved in the
-
Execution:
- Run
main.pyto start the processing.
- Run
- Python 3.x
csvmodule
# Process CSV files in the input folder and save filtered data in the output folder
process_folder(input_folder, output_folder)Adjust the configuration to include or exclude specific columns from the output.
config = {
"email_first": False,
"email_second": False,
"phone": True,
# Add or remove fields as needed
}
phone_filter_include = [] # Include only numbers specified here
phone_filter_exclude = ["04"] # Exclude numbers beginning with strings specified hereNote: Ensure Python script files (main.py and config.py) are in the same directory.