Excel Spreadsheet#

This generator allows you to create a spreadsheet template from your LinkML schema.

See also

SchemaSheets for maintaining schemas as spreadsheets

Example Output#

Using the Person LinkML schema as input, the generated Excel spreadsheet looks as follows: personinfo.xlsx

Overview#

You can create an Excel template of a LinkML schema as follows:

gen-excel ~/path/to/personinfo.yaml --output ~/path/to/personinfo.xlsx

Currently, in the generated Excel workbook there can be one or more associated worksheets, each corresponding to classes from the LinkML schema.

The generator also supports validation at the enum level. In that, each slot with a range property that is of enum type will have associated drop downs for all cells corresponding to that slot in the excel spreadsheet.

Note: It works best for “flat” or denormalized schemas.

Caveat: One of the features of gen-excel is that it has the ability to add Data Validation to columns that have a range of an enumeration type in the form of dropdowns. A caveat within Microsoft Excel is that the Data Validation list formula is limited to 255 characters, meaning, if the length of all strings (permissible values) in your enumeration exceed 255 characters (combined, with separators), then it will result in the creation of a “corrputed” Excel file. You will notice this when you try to open up the Excel file, and Excel will prompt you with an error message saying: We found a problem with some content in ‘xyz.xlsx’. Do you want us to try to recover as much as we can? In order to avoid any warning pop ups, we are simply turning off dropdown Data Validation for columns constrained by enumerations with total length > 255 characters.

Additional validation support to be added:

  • Color schemes to indicate whether a field is required or recommended

  • Constraints based on the range of a slot, e.g. constraining Integer fields to be numbers

  • Tooltip notes describing what each field indicates

Docs#

Command Line#

gen-excel#

Generate Excel representation of a LinkML model

gen-excel [OPTIONS] YAMLFILE

Options

--split-workbook-by-class#

Split model into separate Excel workbooks/files, one for each class

--include-mixins#

Include mixin classes in the generated Excel workbook/workbooks

-o, --output <output>#

Name of Excel spreadsheet to be created, or name of directory to create split workbooks in

-V, --version#

Show the version and exit.

-f, --format <format>#

Output format

Default:

'xlsx'

Options:

xlsx

--metadata, --no-metadata#

Include metadata in output

Default:

True

--useuris, --metauris#

Use class and slot URIs over model uris

Default:

True

-im, --importmap <importmap>#

Import mapping file

--log_level <log_level>#

Logging level

Default:

'WARNING'

Options:

CRITICAL | ERROR | WARNING | INFO | DEBUG

-v, --verbose#

Verbosity. Takes precedence over –log_level.

--mergeimports, --no-mergeimports#

Merge imports into source file (default=mergeimports)

--stacktrace, --no-stacktrace#

Print a stack trace when an error occurs

Default:

False

Arguments

YAMLFILE#

Required argument

Code#