# SpreadScript: Use a spreadsheet as a function This project provides a way to use spreadsheets from the command line or from Python programs.
The inputs and outputs are defined by two tables in a new sheet named “Interface”. SpreadScript will read the input variables from column B and the values from column C. Likewise, the output variables are read from column E and their values from column F. In both cases, the variables are read from row 4 onward until an empty cell is encountered.
## Installation Prerequisites:
apt install python3-uno
Via [PyPI](https://pypi.python.org/pypi/spreadscript):
pip3 install spreadscript
From source:
git clone https://github.com/jfjlaros/spreadscript.git cd spreadscript pip3 install .
## Usage Suppose we have the following table.

If we want to define a and b as input variables and total as the output variable, we first add a new sheet named “Interface”.

In this sheet we put the input variables in column B and the values in column C. The value of C4 is =$Sheet1.C3, that of C5 is =$Sheet1.C4.
Likewise, the output variables are put in column E and the values in column F. In this example, the value in F4 is =$Sheet1.C8.
### Command line interface With the command line interface, the input and output table can be read.
$ spreadscript read_input data/test.ods {“b”: 2.0, “a”: 1.0}
$ spreadscript read_output data/test.ods {“total”: 15.0}
To manipulate the input, use the process subcommand:
$ spreadscript process data/test.ods ‘{“b”: 12.0}’ {“total”: 25.0}
### Library First import the SpreadScript class and load a spreadsheet.
`python >>> from spreadscript import SpreadScript >>> >>> spreadsheet = SpreadScript('data/test.ods') `
The input variables can be read with the read_input method.
`python >>> spreadsheet.read_input() {'b': 2.0, 'a': 1.0} `
The read_output method returns all output variables.
`python >>> spreadsheet.read_output() {'total': 15.0} `
The write_input method is used to update any variables.
`python >>> spreadsheet.write_input({'b': 4.0}) >>> spreadsheet.read_output() {'total': 17.0} `
Metadata
Release files for spreadscript 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spreadscript-0.0.3.tar.gz | 4.7 kB | Without provenance | Details for spreadscript-0.0.3.tar.gz |
Release files / spreadscript-0.0.3.tar.gz
| Download URL | spreadscript-0.0.3.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55cb0ab844f3bea1755d37a9f1d1ec36e1edf0c83d8a8bf668e5f121592964aa
|
|
BLAKE2b-256 checksum How to use checksums |
d5b26eaa928a58f33c4f695b2b6e3f80c5667449f434a47f189b7f3619b62eba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for spreadscript 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.