This application allows you to filter and save specific columns from an Excel file. The filtered data is saved in a new Excel file with a name that includes the original file name and the current date and time. The new file is saved in the out
directory.
- Python 3.x
- pandas
- openpyxl
-
Clone the repository or download the source code.
-
Navigate to the project directory.
-
Install the required Python packages using
requirements.txt
:pip install -r requirements.txt
-
Place the Excel files you want to process in the
source
directory. -
Run the script:
python script_name.py
Replace
script_name.py
with the actual name of your script file. -
Follow the prompts:
- Select the Excel file by entering the corresponding number from the displayed list.
- Enter the column numbers you want to keep, separated by commas (e.g.,
1, 3, 5
). Use a comma (,
) to input multiple column numbers. - The script will create a new Excel file in the
out
directory with the filtered columns.
Assume you have an Excel file named example.xlsx
in the source
directory with the following columns:
- Name
- Age
- Country
When you run the script, you will be prompted to select the file and the columns to keep. If you choose columns 1 and 3 (Name
and Email
), the script will create a new file in the out
directory with a name like example_20220329_123456.xlsx
, containing only the Name
and Email
columns.
- The script will prompt you to enter the exact file name if you provide an invalid file number.
- The output file will be saved in the
out
directory. - The output file name format is
{original_name}_{date_and_time}.xlsx
. - Use a comma (
,
) to input multiple column numbers when prompted to enter column numbers to keep.
This project is licensed under the MIT License. See the LICENSE file for details.