Skip to main content
← All guides

5 min read

Excel won't export your XML ("list of lists"): why, and what to do

By Quentin Delepierre, Salesforce Commerce Cloud consultant

You imported an XML file into Excel, edited your data, and the export fails. It isn't a settings problem: Excel's XML export can only write simple structures. Here's why, and how to get around the limit.

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

"Cannot save or export XML data": "The XML maps in this workbook are not exportable"

On the Developer tab, the Export command (or File › Save As › XML Data) stops on an error. The dialog is titled "Cannot save or export XML data" and says "The XML maps in this workbook are not exportable".

In the XML Source pane, verifying the map for export gives the reason. Most often: a "list of lists".

Which message do you see?

Excel shows two similar messages, with different causes:

  • "Cannot save or export XML data. The XML maps in this workbook are not exportable." (in French Excel: "Les cartes XML de votre classeur ne peuvent pas être exportées"): an XML map exists, but Excel can't write it back, most often because of a list of lists. This is what this guide covers.
  • "Cannot save XML data because the workbook does not contain any XML mappings." (in French Excel: "Excel ne peut pas enregistrer le classeur, car il ne comporte aucune plage mappée"): the workbook has no XML map at all. The next guide covers that case.

Why does Excel refuse to export your XML?

Excel links XML to tables through a map. That map can only be exported if each element keeps an unambiguous place in a flat table. Microsoft lists three structures that prevent it:

  • "List of lists": one list of items contains a second list of items. For instance, products that each have several prices, several images, or one description per language.
  • "Denormalized data": an element meant to occur once is placed in a repeating table.
  • "Choice": a mapped element is part of a choice construct in the schema.
  • The file's comments aren't kept either.

"The XML map can be exported but some required elements aren't mapped"

With this second message, the export goes through, but the file may be rejected by the system that reads it next. The causes Microsoft gives:

  • Required schema elements aren't linked to any column.
  • A recursive structure (an element that contains itself, like a category tree): Excel doesn't support it beyond one level.
  • Mixed content: an element holds both text and child elements ("Press <b>here</b>").

What happens beyond 65,536 rows?

According to Microsoft's documentation, Excel's XML export saves at most 65,536 rows. Beyond that, it only exports the first rows, up to the remainder of the row count divided by 65,537: on a 70,000-row file, only 4,463 rows make it into the XML.

An example: most catalogs

Nearly every catalog export and product feed contains lists inside lists. A single product in two languages is enough:

A list (products) holding a list (descriptions)
<catalog>
  <product id="P001">
    <description xml:lang="fr">Veste coupe-vent</description>
    <description xml:lang="en">Windproof jacket</description>
  </product>
  <product id="P002">
    …
  </product>
</catalog>

Can you work around the limit inside Excel?

  • Simplify the schema so it has no nested lists: rarely possible, since the system that will import the file (Business Manager, Merchant Center, your PIM) imposes its structure.
  • Write a macro or a script that rebuilds the XML: it works, but it has to be built, maintained, and redone for each format.
  • Save as "XML Spreadsheet 2003": this format describes an Excel workbook (sheets, cells, styles), not your file's structure; the target system will reject it. And "XML Data", in Save As, goes through the same map as the export: it fails the same way.
  • Power Query (Data › Get Data › From File › From XML) reads nested XML very well and flattens it into a table, but it can't write XML: you can read your file, not save it back.

The method without XML maps

ExcelifyXML doesn't go through Excel's maps. It flattens the XML into a table (an Excel file or a CSV), keeping the file's structure aside, then rebuilds the XML from the edited table. Nested lists become columns (description[fr], description[en], image[0], image[1]), and reconstruction puts them back in place.

With one row per order, the inner lists become numbered columns: lines.line[0].@sku, lines.line[0].discounts.discount[1].@code, lines.line[0].discounts.discount[1]… Reconstruction puts them back at their level.

One limit: text mixed with tags ("Press <b>here</b>") doesn't fit in a cell. Only the tags' text is kept; the preview and the result screen point it out.

  1. Drop your XML file on the Upload page: the free preview shows the detected row and the resulting columns.
  2. Confirm (1 credit) and choose the Excel file (.xlsx) — or the CSV, in a bundle with skeleton.json.
  3. Edit the file in Excel, like any table, and save it.
  4. On the Rebuild page, drop the saved Excel file, alone (or the edited data.csv with its skeleton.json): you get the XML back, nested lists included. No 65,536-row limit on our side: reconstruction accepts up to 1,000,000 rows and 100,000 columns, in a dropped file of 4.4 MB at most (roughly 10 to 30 MB of XML, depending on the content). Your spreadsheet has its own limits: 16,384 columns in Excel and LibreOffice, 32,767 characters per cell in Excel; if it cut columns or values, the reconstruction stops and tells you.

Variant: regenerate the XML from Excel

Want to keep an export button inside Excel? The standalone Excel workbook (2 credits) holds your data and a "Generate XML" button that can write nested lists. Generation happens in Excel, on your computer, offline. It needs desktop Excel, on Windows or Mac.

Going further

Edit your XML in Excel, without XML maps:

Transform a file