csvsheet 0.1.2

Creator: bradpython12

Last updated:

0 purchases

TODO
Add to Cart

Description:

csvsheet 0.1.2

csvsheet

Simple formula support for CSV


Description
The aim of this project is to provide simple math capabilities to CSV files.
The capabilities are reduced to be able to use python formulas in a cell.
The formulas are evaluated using eval, so a basic sanitazion is done to avoid major risks, to do so, only math library can be used as well ass int, float and +|-|*||(|).


Command line usage
The command line requires a single compulsory arugment, the CSV fileto process:
csvsheet <file.csv> -o <output.csv> -d <delimiter> -q <quotechar> -m <equation_delimiter> -v -vv
csvsheet --help
The input file is required, if ‘-’ is used, stdin is used.
The output file is optional, if not provided, the output will be printed to stdout.
The delimiter is also optional, if not provided, the default delimiter is ,.
The quotechar is also optional, if not provided, the default quotechar is “.
The equation delimiter is also optional, if not provided, the default equation delimiter is =.
The -v and -vv flags are optional, they are used to increase the verbosity of the output.
Read the extended docs for extra information.


Example
The following example shows how to use the command line:
csvsheet example.csv
If the contents of example.csv are:
item,result
Great,=1+2
Not so great,=math.pow(2, 3)
The output will be:
item,result
Great,3
Not so great,8.0


Python usage
The python usage is very simple, it is only required to import the csvsheet module and call the run function:
import csvsheet

csvsheet.run(["tests/test_a.csv"])


Making Changes & Contributing
This project uses pre-commit, please make sure to install it before making any
changes:
pip install pre-commit
cd csvsheet
pre-commit install
It is a good idea to update the hooks to the latest version:
pre-commit autoupdate
Don’t forget to tell your contributors to also install and use pre-commit.


Note
This project has been set up using PyScaffold 4.4.1. For details and usage
information on PyScaffold see https://pyscaffold.org/.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.