Skip to main content
← All guides

6 min read

Excel won't save as XML: "the workbook does not contain any XML mappings"

By Quentin Delepierre, Salesforce Commerce Cloud consultant

You never created an XML map in this workbook, or you opened an XML file and then picked "XML Data" in Save As, and Excel refuses: the workbook has no XML map. It's not a bug: without a map, Excel doesn't know which structure to write. Here is where the message comes from, what you can do in Excel for Windows, and the method 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

Why does Excel refuse to save as XML a file you opened?

This message mostly comes from one scenario: you open an XML file in Excel, edit the table, then ask to save it as XML. It all depends on how the XML was opened, because only the "As an XML table" option creates a map.

  • Opened "As an XML table": a map exists. If Excel still refuses, check in Developer › Source that it wasn't deleted; otherwise the message is probably the other one, the "list of lists" error.
  • Opened "As a read-only workbook": no map was created. This is the most direct cause of this message.
  • A workbook unrelated to any XML file (CSV, hand-typed file, pasted data): there was never a map to export.

The message and when it appears

It appears when you save a workbook as XML: File › Save As, type "XML Data", or Developer tab › Export. It is often reported as "Cannot save XML data because the workbook does not contain any XML mappings" (the exact wording varies between Excel versions).

Microsoft's documentation describes this case under the heading "Excel can't save the workbook because it doesn't have any mapped ranges", with this explanation: "Excel can't save your workbook in the XML Data file unless you create one or more mapped ranges." Don't mix it up with "The XML Maps in your workbook can't be exported": there, a map exists but Excel refuses to export it (see the guide on the "list of lists" error, below).

Why does Excel say the workbook has no XML map?

An XML map is the link Excel keeps between cells and the elements of an XML schema. The export writes the data of those cells by following the map. No map, no structure to write: Excel stops. To check, open Developer › Source: if the XML Source pane is empty, the workbook has no map.

The most common cases:

  • The XML file was opened "As a read-only workbook". Microsoft says it plainly: in that case Excel doesn't infer a schema and you can't use an XML Map. Only the "As an XML table" option creates a map.
  • The workbook doesn't come from an XML file: a CSV, an Excel file created or typed by hand, data copied into a new workbook. Nothing ties its cells to a schema.
  • The map was deleted (XML Source pane, or Developer tab › Source › XML Maps), or the data was pasted outside the mapped cells.

Can you save as XML with Excel for Mac or Excel for the web?

Microsoft states that only Excel for Windows offers XML mapping: these tools aren't available in Excel for Mac or Excel for the web. On a Mac there is no map to add, so the message can't be fixed inside Excel.

What you can try in Excel for Windows

If you have the original XML file, the simplest way is to reopen it so the map gets created: File › Open, pick the XML file, then "As an XML table" in the "Open XML" dialog. If the file doesn't refer to a schema, Excel infers one from your data. Redo your edits in that table, then export.

Otherwise, you can add a map from an XSD schema, if you have one (it describes the XML the target system expects):

  1. Developer tab › Source: the XML Source pane opens.
  2. In the pane, choose "XML Maps", then "Add".
  3. Select the .xsd file, then "Open" and "OK". If the "Multiple Roots" dialog appears, choose one of the root nodes defined in the schema.
  4. Drag the elements from the pane to the worksheet, where you want them, to map them: mapped elements show in bold.
  5. Put your data in those cells (copy it into the mapped columns), then Developer › Export.

The limits of that route

  • You need an XSD schema or an original XML: a table alone isn't enough.
  • Excel doesn't handle every schema: Microsoft lists the <any> and <anyAttribute> elements, recursive structures more than one level deep, abstract elements, substitution groups and mixed content.
  • A map can exist and the export still fail: nested lists (a "list of lists", such as products that each have several descriptions per language), "denormalized" data or "choice" constructs. Catalogs and product feeds almost always contain them.
  • According to Microsoft, the export saves 65,536 rows at most and doesn't keep the file's comments.

How do you edit your XML without an XML map?

ExcelifyXML doesn't use Excel's maps: it flattens your XML into a table, keeps the file's structure aside, then rebuilds the XML from the edited table. There is no map to create, and the method doesn't need Excel for Windows: the Excel file (.xlsx) or the CSV opens in Excel, LibreOffice, Google Sheets or Numbers.

  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, like any workbook, and 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 XML back with its original structure, nested lists included.

You only have the table, not the original XML

A table alone doesn't say which XML to write: the same grid can become a thousand different XML files. You need a template XML, an example of the file the target system expects: ExcelifyXML transforms it, you paste your rows into the resulting table, and the Rebuild page writes your data in that shape.

Edit your XML in Excel, without an XML map:

Transform a file