Export grid views to CSV
The syside grid export command of the Syside CLI writes the
table and
matrix views a model defines to CSV files,
one file per view, ready to open in a spreadsheet. This guide exports one view of a
small requirements model, then several, then all of them to a directory you choose.
Before you start
Make sure the Syside Python Library & CLI is installed and activated.
Get
SysideViews.sysmlfrom the Sysand registry, or from the SysMLv2 Views panel’s prompt in the Syside VS Code Extension (see SysMLv2 Views panel). The example’s views import this library, and the example download does not include it.Download and extract the example model, then place
SysideViews.sysmlin the root of the extractedgrid-exportfolder. The commands below assume the library sits there, next to the model files:Open a terminal in the
grid-exportfolder. Every command below runs from there.
The example defines three views in RequirementsViews.sysml: two tables listing the
stakeholder and the system requirements, and a matrix showing which system
requirement is derived from which stakeholder requirement.
Export one view
Pass the view’s qualified name with -n:
syside grid export -n RequirementsViews::systemRequirements
Without paths, the command loads the model in the working directory. It lists each
other view as skipped, which is expected. A new output directory should hold one
file, named after the view’s qualified name:
output/
└── table-RequirementsViews__systemRequirements.csv
The table holds one row per requirement and one column per column view:
Export several views
Repeat -n once per view:
syside grid export -n RequirementsViews::stakeholderRequirements -n RequirementsViews::requirementDerivation
The stakeholder requirements table and the matrix are written next to the file from the previous step, and the system requirements table is skipped:
output/
├── matrix-RequirementsViews__requirementDerivation.csv
├── table-RequirementsViews__stakeholderRequirements.csv
└── table-RequirementsViews__systemRequirements.csv
A file name depends only on its view, so exporting a view again rewrites its file rather than adding a new one.
Export every view to a directory
Leave out -n to export every view, and set the output directory with -o, which
creates the directory when it does not exist:
syside grid export -o tables
A new tables directory should hold one file per view:
tables/
├── matrix-RequirementsViews__requirementDerivation.csv
├── table-RequirementsViews__stakeholderRequirements.csv
└── table-RequirementsViews__systemRequirements.csv
Compatibility with other tools
The files are UTF-8 encoded. Some tools, such as Microsoft Excel, do not assume
that and guess the encoding instead. They can then misread characters outside
English, such as ü or °. This can be fixed by adding a byte order mark at the
start of the file using the flag --bom:
syside grid export --bom
For every option, see the grid command reference, or its exit codes if the export did not finish.