Importing ReqIF file via xlsx2reqif python code conversion

Let me suggest another approach that gives you better control of attribute data types and what goes into the resulting ReqIF file. I’ve used ReqView, which has excellent Excel import and ReqIF export capabilities suited for Capella:

  1. Create a project in ReqView.
  2. Add custom attributes of appropriate types for everything in your Excel files. I’ve only added origID as a string based on your example Excel file.
  3. To import the Excel file, we need to modify it first:
    1. Rename column ID to origID
    2. Fill in the level column based on the hierarchy
    3. Create heading and text columns and fill one of them with contents of Lvl X Req – e.g. use heading if it has descendants and text otherwise
    4. Delete the Lvl X Req columns
    5. Save it as CSV UTF-8 file and then import into the ReqView document
  4. You should get something like this in ReqView:
  5. Export ReqIF to Capella, ensure Export for Capella MBSE is checked so that ForeignIDs are numeric and that a .properties file with all custom attribute names is generated
  6. You should get something like this in Capella:
    image

It might seem a bit complicated, but using this approach will allow iterative updates from CSV to ReqView as well as from ReqView to Capella using ReqIF – the internal identifiers of all objects are persisted. Once you import the stuff into ReqView, there’s not much point in using Excel anymore though.

Hope this helps, I’m attaching all the files involved.

Richard

reqif_testfile.reqif (32.1 KB)
reqif_testfile-reqview.csv (1.1 KB)
reqif_testfile-reqview.xlsx (10.1 KB)
reqview_prj.reqw (24.6 KB)