csvsheet package

Submodules

csvsheet.csvsheet module

csvsheet - A simple CSV calculator.

This module and command line application allows to perform calculations on CSV files. It is not intended to be a full spreadsheet replacement, but rather a simple tool to perform basic math operations on CSV files. The main reason is that CSV is far friendlier to version control systems than binary formats like XLSX.

csvsheet.csvsheet.main(args: list[str])[source]

Deals with command line parameters and input/output.

Args:

args (List[str]): command line parameters as list of strings

(for example ["--verbose", "42"]).

csvsheet.csvsheet.parse_args(args: list[str]) Namespace[source]

Parse command line parameters.

Args:

args (List[str]): command line parameters as list of strings

(for example ["--help"]).

Returns:

argparse.Namespace: command line parameters namespace

csvsheet.csvsheet.run()[source]

Calls main() passing the CLI arguments extracted from sys.argv.

This function can be used as entry point to create console scripts with setuptools.

csvsheet.csvsheet.sanitize_cell(cell: str, mathdelimiter: str = '=') str[source]

Sanitize a cell.

Args:

cell (str): string from CSV cell mathdelimiter (str, optional): delimiter to identify formulas. Defaults to “=”.

Raises:

ValueError: cell contains invalid functions

Returns:

str: Sanitized string to be used in eval()

csvsheet.csvsheet.setup_logging(loglevel: int)[source]

Setup basic logging.

Args:

loglevel (int): minimum loglevel for emitting messages

Module contents