Skip to main content
← All guides

6 min read

Excel XML: "some required elements aren't mapped"

By Quentin Delepierre, Salesforce Commerce Cloud consultant

Excel warns you that the XML map can be exported, but that some required elements aren't mapped. It isn't a fault: it means the exported XML won't contain elements the schema requires. Here is what Microsoft says about it, how to spot those elements in the XML Source pane, and the route without an XML map.

Got your own XML? Drop it in and see it as a table, free and with no account. For an Excel file you can edit and then rebuild into an XML that keeps its structure, a free account is all you need.

Transform a file

Simple Excel table, free with no account, for files up to 1 MB. File that rebuilds into XML: free account, 3 free credits, no credit card.

Download an example result (.xlsx)Example source XML

What does "some required elements aren't mapped" mean in Excel?

It is one of the messages Microsoft describes for the XML export. It says the XML map can be exported, but that one or more elements the schema marks as required aren't linked to any cell of the worksheet. Excel only exports the contents of mapped cells, so those elements aren't written into the XML. Microsoft gives two other possible causes for the same message: a recursive structure, and mixed content.

The exact message, in English and in French

Microsoft's page on exporting XML data titles it "The XML Map can be exported but some required elements aren't mapped". In French: « La carte XML peut être exportée, mais certains éléments requis ne sont pas mappés ».

The page "Issue: Verifying an XML map for export" words it differently: "I get a message saying that the map can be exported, but some required elements have not been mapped". Microsoft presents these titles as messages you may get; the exact text of the dialog may vary between Excel versions.

How do you spot the required elements in the XML Source pane?

In the hierarchical list of the XML Source pane, Microsoft says required elements carry a red asterisk on the top-right corner of the icon to the left of the element. A mapped element shows in bold. So look for the elements with a red asterisk that aren't in bold.

  1. Developer tab › Source: the XML Source pane opens.
  2. In the list, find the elements with a red asterisk that aren't in bold: they are required and not mapped.
  3. Drag each one to the worksheet location where you want it to appear, as Microsoft advises.
  4. Run the export again (Developer › Export). The pane's command that checks whether the current map can be exported also lets you verify.
  • Attributes and repeating elements are concerned too: Microsoft's icon table gives each type a "required" version (parent element, child element, attribute, simple content in a complex structure, and their repeating versions).

What is the difference between a required and an optional element on export?

In an XSD schema, an element is optional when it carries minOccurs="0"; without that attribute, it is required. Excel follows that distinction: according to Microsoft, it doesn't create empty elements when cells are blank for an optional element, but it does for a required element. By its wording, the message is only about required elements, not optional elements left unmapped. And you choose which elements to map, so there is no need to map the optional ones you don't need.

A schema example: required and optional

A made-up schema describes a product with a reference, a price and a note. Only the note is optional:

XSD schema: reference and price required, note optional
<xsd:element name="product">
  <xsd:complexType>
    <xsd:sequence>
      <xsd:element name="reference" type="xsd:string"/>
      <xsd:element name="price" type="xsd:decimal"/>
      <xsd:element name="note" type="xsd:string" minOccurs="0"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>

What if every required element is mapped?

The message has two other causes, according to Microsoft. The page offers no fix for these two cases:

  • A recursive structure: an element that contains itself, like the hierarchy of employees and their managers. Excel doesn't support recursive structures more than one level deep, and can't map all the elements, even if you dragged them all onto the worksheet.
  • Mixed content: an element holds both a child element and plain text, for example formatting tags such as bold inside a value. The text is lost on import and isn't available on export.

Should you keep the "Validate data against schema" option?

This option is in the XML Map Properties (Developer › Map Properties, in the XML group): "Validate data against schema for import and export". Microsoft says it is active by default and that it sets whether Excel validates data against the XML map when exporting; it suggests ticking it when you want to be sure the exported XML conforms to the schema. The page doesn't present it as a fix for this message: don't untick it to make the message go away.

If you only want to finish your export from Excel

Map the required elements as above: it's free and it is Microsoft's method. It assumes Excel for Windows: Microsoft says XML mapping isn't available in Excel for Mac or Excel for the web, and calls XML maps a legacy feature.

The method without an XML map

ExcelifyXML doesn't fix your XML map: it offers another route. You start from the original XML, you get an Excel table, you edit it, then the Rebuild page rewrites the original XML, with its structure. There is no map, so no required element to map.

One limit: ExcelifyXML rebuilds from the structure of the original XML, not from a schema. If you empty the cell of a field the target system requires, the tag disappears from the rebuilt XML.

  1. Drop your XML file on the Upload page (free account: 3 credits at sign-up, then 1 free credit a week, not cumulative). The file can be up to 4 MB on the free plan, 30 MB on the Pro plan. The free preview shows the detected row and the columns you get.
  2. Confirm (1 credit, refunded if it fails) and choose the Excel file (.xlsx), or the CSV in a bundle with skeleton.json.
  3. Edit the table in Excel, then save it.
  4. On the Rebuild page (free), drop the saved Excel file on its own (or the edited data.csv with its skeleton.json): you get the original XML back, with its structure.

What happens to your file

Your file is processed in memory on European Union servers, then deleted immediately. Above 4 MB, it goes through a private, encrypted transit space for the time of the preview and the transformation, then it's wiped (at the latest one hour after the upload). No metadata is kept.

Going further

Edit your XML in Excel, without an XML map:

Transform a file