Writing data to an Elda spreadsheetΒΆ

The Elda class is used to handle an elda file. If no filepath is provided to the Elda constructor, the object will be created from a blank elda template.

Writing process data in an elda can be done by appending a new version to it or by updating last existing version, respectively with add_version() and update_last_version(). When adding a new version to the elda, the program creates a new sheet in the xls file by copying the last one and removing unwanted data. When copying the sheet, some style elements are lost, this can be fixed with fix_style(). Similarly, the comments position and size are lost when reading the sheet. This is fixed by fix_comment_size().

According to the type of the new version (major or minor), more or less data will be removed. For major versions, every data is removed and the version is created from scratch. For minor versions, every data input by the user itself are kept, only data automatically generated on basis of the .xlsx content are removed.

The data removal and insertion is not made by the instance of Elda itself but by an instance of EldaVersionWriter created by add_version() , update_last_version() or update_last_version_metadata().

EldaVersionWriter is the class used to write data in an elda sheet. It has methods for removing and inserting data (clean_data() and add_process_data()). Its method add_process_metadata() only populates the metadata fields (except the name and synonym). It is used by update_last_version_metadata() to copy metadata from an Elda to another.

EldaVersionWriter also features a method named insert_parameter() that is called by add_process_data() and allows to insert an InputParameter or a CalculatedParameter data and to add a named cell referring to this parameter value cell in the workbook. When a parameter block is full, insert_parameter() will call add_parameter_block() and generate a new parameter block.

After adding a new version or updating last version of an elda, data must be saved with save().

from eldam.core.elda import Elda

# Creating an elda from scratch
new_elda = Elda()

# Updating an existing elda
elda = Elda('path/to/elda')
elda.add_version(process3, major_version=True)