6 min read
Edit XML in Excel and save it back as XML
By Quentin Delepierre, Salesforce Commerce Cloud consultant
Excel is the ideal tool to change thousands of values, but it can't write a structured XML back. ExcelifyXML offers two ways to edit XML in Excel and get XML back: online, or with a standalone Excel workbook whose button regenerates the file.
Turn your XML into a standalone Excel workbook:
Free account, 3 free credits, no credit card.
Two ways to edit XML in Excel
- Online (standard mode): you drop the XML, download an Excel (.xlsx) file or a CSV (1 credit), edit it in Excel or another spreadsheet, then drop it alone on the free Rebuild page to get the XML back. Transform, edit, rebuild: it works in Google Sheets, Numbers or LibreOffice too.
- Offline, with the standalone workbook (.xlsm, 2 credits): your data and a "Generate XML" button in the same file. You edit and regenerate the XML in desktop Excel, on your computer, as many times as needed.
The problem: Excel reads XML, but writes it back poorly
Excel can import an XML file, but its native XML export only handles simple structures. As soon as the file contains nested lists — a product that itself carries several values, such as one description per language —, Excel refuses to export or produces a file that differs from the original. That's the case for most catalog exports and product feeds.
According to Microsoft's documentation, this export (Developer tab, XML maps) stops at 65,536 rows, refuses "lists of lists" and "denormalized" data, and drops the file's comments.
The result: you edit the data in Excel, then patch the XML by hand or with a script. It's slow and risky: one badly closed tag is enough for the import to be rejected.
The standalone workbook, step by step: a workbook that regenerates its own XML
- On ExcelifyXML, open the Excel workbook page and drop your XML file: a free preview shows the detected row and the first rows of your data. Then click "Generate my workbook" (2 credits).
- Download the .xlsm workbook and open it in Excel. On Windows, unblock it first: right-click the file › Properties › tick "Unblock" › OK.
- Edit the "Data" sheet: fix values, add or delete rows, sort. Your data starts on row 3; row 2 holds readable labels you can rename as you like.
- Click "Generate XML" and choose where to save the file.
- Import the XML into your tool (Business Manager, Merchant Center, PIM…), preferably on a test environment first.
Why the workbook?
- Regeneration happens in Excel, on your computer, offline: fix and regenerate as many times as needed, without coming back to the site or spending credits. That's what sets it apart from the standard mode.
- Your data is written as text, as in the standard mode's Excel file (.xlsx): leading zeros (00123), EAN/GTIN codes and dates stay exactly as in the XML, with no automatic conversion by Excel.
- No separator to worry about: there's no CSV to save again, so no more file opening in a single column.
- Columns that are easy to recognize: under the technical names, a row of readable labels, filled in for you and editable, with no effect on the XML.
- If its macros are blocked, save the workbook (.xlsm) and drop it as is on the Rebuild page: the site reads its "Data" sheet, without running the macro, and rebuilds the XML online. The standard bundle (CSV + manifest), included with every workbook, works too; an older workbook, which doesn't hold its structure yet, is dropped with that bundle's skeleton.json ("Separate files").
Good habits in the workbook
- To paste data from another file, use Paste Special › Values.
- Don't change row 1: these technical names tell where each value goes in the XML. To find your way, rename the labels on row 2 instead.
- Sort and filter with the arrows on row 2: both header rows stay in place.
- Filters exclude nothing: every row is exported. To remove an element, delete its row.
- Before writing, the macro asks you to confirm when some cells can't go into the XML (a value typed on a row of another type, a copied column whose copies differ), hold invisible characters pasted from another program, or when codes of different lengths lost every leading zero: Yes writes the XML without those cells, without those characters or with those codes as they are, No stops everything so you can fix them.
- Like the online reconstruction, the macro gives damaged values back their original form: a code shorter than the others of its column (EAN, postal code) gets its leading zeros back, a TRUE or FALSE you type takes the original file's spelling, and a value you clear removes its tag.
- Always save as .xlsm: saving as .xlsx removes the macro.
When is the standard mode (Excel file or CSV) a better fit?
- You work in Google Sheets, Numbers, LibreOffice, Excel for the web or Excel on iPad: these tools don't run macros. The standard mode's Excel file (.xlsx) can be edited there, its values as text, and rebuilt online.
- Your company forbids macros: the standard mode rebuilds online, without macros.
- You're making a one-off change: 1 credit instead of 2, and online reconstruction stays free and unlimited.
What about privacy?
Turning your XML into a workbook happens on our servers, in the European Union, in memory, without keeping the file (above 4 MB, it goes through a private, encrypted transit space, wiped at the latest one hour after the upload). After that, your edits and the XML generation happen in Excel, on your computer, offline. The macro makes no network connection and its code is published.
Turn your XML into a standalone Excel workbook:
Generate my workbook