You can also import model elements through a class mapping. A class mapping contains properties of a schema class and a target element that you have mapped together. The type of the target element that you selected in the class mapping determines how the plugin imports and creates the model elements. If the target element is a user model, the plugin will import data as instance specifications of the user model. However, if the target type is a element in UML or a SysML profile, the plugin will import data as UML or SysML element type respectively.

Importing data through a class mapping requires the number and the name of columns in the file to be the same as those in the selected class mapping.

The Import Data from Excel menu in the Import Data from Excel and Create Mapping dialog, see figure below, opens the wizard that allows you to import data according to the class mapping you created. This menu is also useful if you want to import data from an Excel or CSV file as instance specifications of the schema class you have imported. See section Importing Instance Specifications after Creating a Schema Class for details on importing instance specifications using the Import Data from Excel menu.

You can open the wizard to import elements from a class mapping through either (i) The main menu or (ii) The context menu. If you want to import elements by using the main menu, you need to click File > Import From > Excel/CSV File > Import Data from Excel. If you use the context menu, you can right-click a class mapping in the Containment tree in MagicDraw and select Tools > Import Data from Excel.

Either method opens the Import Data from Excel wizard. The only difference is that the context menu will choose the class mapping, which you have already selected in the Containment tree, in the Select a mapping option page by default. However, you can change the default class mapping in the wizard to another one.

(ii) To import data according to a class mapping through the main menu


  1. Click File on the MagicDraw main menu and click Import From > Excel/CSV File. The Import Data from Excel and Create Mapping dialog will open, as shown in the figure below. 

    The Import Data from Excel Menu

  2. Click the Import Data from Excel menu and click OK. The Import Data from Excel wizard will open, as shown in the figure below. 

    The Select a File Option Page

  3. Click to find an Excel or CSV file.
  4. Select a file and click Open.
  5. Click . If the file you have selected in step 3 above is an Excel file that has data in more than one sheet contain data, the Select sheets option will be enabled, see figure below. Otherwise, skip step 6. 

    Selecting Excel Sheets to Import

  6. Select one or more sheets in the Excel file whose data you are going to import and click. The Select a mapping option will open, see figure below. 

    Selecting a Class Mapping Option Page

  7. Select a class mapping to which you want to import the elements.
  8. Click either (i) to import the elements into the package where the class mapping is located or (ii)  to select a new package using the Select a package option, as shown in the figure below. 

    Selecting a Package

  9. Select, create, or clone a package to store the to-be-imported elements from the treeview.
  10. Click

To import data according to a class mapping through the context menu


  1. Right-click a class mapping in the Containment tree, as shown in the figure below. 
    Opening the Context Menu of a Class Mapping in the Containment Tree

  2. Select Tools > Import Data from Excel. The Select a file page will open, as shown in the figure below. 

    Importing Data through the Context Menu

  3. You can click: 

(i) to find a file and click .
(ii)  and skip the following steps.

If you click  at this point, the wizard will:

  • Import data from the file and the sheet of the schema class of the selected class mapping.
  • Save imported data in the package where the class mapping is located. 

(iii) to select the sheets of using the Select sheets option, see the first figure below. If you are importing a CSV file, the wizard will skip the Select sheets page and open the Select a mapping page, see the second figure below.

The Select sheets option page will not open if:

  • a selected Excel file has only one sheet.
  • a selected Excel file has several sheets but only one sheet contains data.
  • a CSV file is selected. 

Selecting Sheets to Import Option Page 

    4. Select one or more sheets in the Excel file with the data to import and click . The class mapping you have selected in the Containment tree will open in the Select a mapping option page, see figure below.

Selecting a Class Mapping Option Page

    5. You can select another class mapping from the treeview.
    6. Click either (i)  to import the element into the package where the class mapping is located, or (ii)  to select a package to store imported elements through the Select a package option page, as shown in the figure below.

Selecting a Package toStore the Imported Elements 

   7. Select, create, or clone a package to store the to-be-imported elements or instance specifications from the treeview, see figure above.
   8. Click .