Simple VBA Excel to EA importer v2

There is an updated version available. Check out EA Excel Importer V4

The Excel to EA importer is a rather simple tool to import stuff into EA.

It has been available on the Sparx Community Site since 2009 and it has always been one of the most popular resources.

Now I decided to improve it a little bit and publish version 2.

Download

Download the excel file here: EAExcelImporter_v2

Usage

Columns A till F are used in the sheet. Fill in the the columns with your own data.

  • Type
    Fill in the type of the Element you wish to import. This column should contain either Attribute or one of the EA Element types as defined in the documentation of EA.Element.Type. An attribute will be added to the last specified Element.
  • Name
    The name of the element or attribute.
  • Stereotype
    The stereotype of the element or attribute. Use null to specify an empty stereotype.
  • Description
    The description of the element or attribute.
  • Attribute Type
    The type of the attributeThis column should not be used for Elements. Use null to specify an empty type.
  • Attribute Length
    This value will be added as a tagged value with the name length on the attribute.  Again this is only for attributes.

Once all you data has been filled in you can either run the macro (Alt-F8) importFromExcel or press the Import button

Customizing

The code of this little tool is embedded as VBA in the document, and as such can be edited by anyone with basic programming skills.

To open the code editor press Alt-F11.

There are three major parts for the code

  • ExcelImporter
    The module that contains the importFromExcel macro. This is where you want to make changes.
  • EAConnector
    A facade for EA’s API containing all kinds of useful functions. You probably don’t need to change anything here.
  • ExcelConnector
    A facade for Excel with the code to get the values of the sheet. Again probably no need to change anything here.

Both the Excel file as the VBA code embedded in it is free for use. Just be kind and leave the reference to my name in the code if you use it.

25 replies
  1. Slávek Rydval
    Slávek Rydval says:

    Hi Geert,

    you should mention that this script makes the same thing as the “CSV Import/Export…” in EA except the attributes. And that’s why your script is so useful.

    Reply
  2. wikitect
    wikitect says:

    … and is it possible to use the Stereotype to refer to a profile with custom stereotypes e.g. MyProfile::MyStereotype … so that I can use my specialisation of a Requirement class for example?

    Reply
    • geertbellekens
      geertbellekens says:

      Relationships is definitely something you could add, that’s relatively easy.
      You should try it, but I think the MyProfile::MyStereotype should work. The VBA part will just treat it as a string.
      You might need to call an additional EA.Repository.SynchProfile() (or something like that) to get all the tagged values and other stuff that comes with eh stereotype.

      Reply
      • wikitect
        wikitect says:

        Thanks, Geert – as ever this might help solve a number of problems – 1) trying to illustrate the dependencies using a spreadsheet with 800+ rows of connections; 2) overcoming the limitation that comes with the DOORS importer that only works with the basic Requirement class (I’d like to use the TRAK profile that extends this).

        Reply
  3. Paulus
    Paulus says:

    Hi Geert,

    I modified your importer to import glossary items. I think it would be a useful extension since manually entering glossary terms is quite cumbersome (or am i missing something?). If you think so too let me know and i’ll send you the modifications (the are straightforward).

    Reply
  4. myersk
    myersk says:

    Hi, does this importer work for importing use case steps into the structured specifications tab? Thanks.

    Reply
    • geertbellekens
      geertbellekens says:

      No, not as is, but I believe you should be able to modify it in order to import use cases and scenario’s.
      In that case you should be importing EA.Element of type UseCase, EA.Scenario and EA.ScenarioStep in stead of just Element and Attribute.

      Reply
  5. Werner
    Werner says:

    How does it know in which EAP file or package it will import?
    I get an error :”Compile error: can’t find project or library”, debug stops at “Public Sub importFromExcel()”

    Reply
  6. wilsondebs
    wilsondebs says:

    This importer is great – so useful for importing large coded domains. I’m trying to import code lists for use with the ArcGIS UML Profile which uses the initial value as an alias. How can I configure VBA code to import a column into the initial value?

    I can successfully import values into the alias but there is no option for Initial in the myAttribute.* public Function addOrUpdateAttribute in the EA Connector

    Reply
  7. boobeek
    boobeek says:

    Hello,

    Thanks Geert for VBA.. very useful.
    Anyway, no clue how to solve problem with good export/import tool for interfaces.
    MS integration is useless, eadocx useless as well.
    I have lots of components which represents applicatio or system. every system has provided and required interface. Interfaces are created as separate object interface type and assigned to exposed interfaces joint with dependancy connection, or information flow connector.
    I need to achive to show on one row in csv or xls where can I see ComponentA, ComponentB, information flow direction, or which component provide and require interface, and interface name link.

    Is that possible to do it somehow with available tools?
    Thanks
    Boris

    Reply
    • Geert Bellekens
      Geert Bellekens says:

      Hi Boris,

      If you are only looking for an export from EA to CSV or excel, might want to look into SQL searches.
      I usually use those when I need to export something from EA to Excel. Only in exceptional cases, where the logic is too complex to be written in SQL, I use programming code to export data from EA.

      Geert

      Reply

Trackbacks & Pingbacks

  1. […] Version 2 was a small improvement allowing for different types of Elements. […]

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.