Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bclindner/python-xls-csv-convert
https://github.com/bclindner/python-xls-csv-convert
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/bclindner/python-xls-csv-convert
- Owner: bclindner
- Created: 2023-02-19T18:40:34.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-19T18:56:03.000Z (almost 2 years ago)
- Last Synced: 2024-11-11T10:51:53.852Z (2 months ago)
- Language: Python
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Python XLS-to-CSV Processing Script
This script opens an `employee.xls` file at a provided path with the format:
| employeeid | expense1 | expense2 | expense3 | totalexpense |
|------------|----------|----------|----------|--------------|
| 1 | 1 | 2 | 3 | |
| 2 | 10.10 | 31 | 4 | |
| ... | | | | |It then sums the columns from `expense1`, `expense2`, and `expense3` and writes
a new verson of this file, `employee.csv`, with the result of the summed columns
in the `totalexpense` column.## Setup
This project is an unpackaged Python script. You will need Python 3.8 and pip to
run it - please make sure it is installed and in your PATH before continuing.Download or clone this repository:
```
git clone https://github.com/bclindner/python-xls-csv-convert
cd python-xls-csv-convert
```A virtual environment would be recommended, to avoid polluting your system's
Python installation.Linux instructions:
```sh
python -m venv venv
. venv/bin/activate
```Windows instructions:
```ps1
python -m venv venv
venv/Scripts/activate.ps1
```Once your virtual environment is initialized, install the requirements:
```
pip install -r requirements.txt
```You can now launch the script - run this command with the directory of the XLS
file as an argument:```ps1
python run.py C:\temp\incoming\employee.xls
```If everything was set up correctly, the program should have created a new file,
`output.csv`, in the same folder as the `employee.xls` file.The script is configured to fail on the following cases, for safety:
* A path was not specified when running
* The path specified is not a file or does not exist
* The output.csv file already exists