5 min read
Excel file (.xlsx) or CSV: which format to edit an XML file?
By Quentin Delepierre, Salesforce Commerce Cloud consultant
After your XML file is transformed, ExcelifyXML lets you choose between an Excel file (.xlsx) and a CSV. Both hold the same data and the same structure, but they don't suit the same use. Here is what each one contains, why the .xlsx is safer in a spreadsheet, and the cases where CSV is the right answer.
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.
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.
The choice in short
- You edit by hand in Excel, LibreOffice, Google Sheets or Numbers: take the Excel file (.xlsx).
- You go through a script, another tool, or a file too big or too wide for Excel: take the CSV.
- Both come from the same transformation, for the same credit: the Excel file and the CSV are downloaded from the same result screen.
What each format contains
- The Excel file (.xlsx): a data sheet (the headers, one row per XML element, every value written as text, frozen headers with a filter) and a hidden sheet, _excelify, that keeps the XML's structure. You send back only that file.
- The free Excel table, no account needed: a simple .xlsx, for an XML of 1 MB or less. A single sheet, the same cells, but without the structure sheet: it is for reading and editing the data, and can't be rebuilt into XML.
- The CSV: a .excelify.zip archive that holds two files, data.csv (the data to edit) and skeleton.json (the XML's structure). Both are needed to rebuild.
Why the .xlsx keeps zeros, long codes, dates and TRUE/FALSE
A CSV opened by double-click is interpreted by Excel: “00123” becomes 123, an EAN code becomes 3.61235E+12, “1-2” becomes a date, true becomes TRUE. None of this is a defect of the file: it is Excel's automatic conversion, which rewrites what it thinks it recognizes.
In the .xlsx, every value is saved as text and every column has the Text format: what you type stays text. There is no separator or encoding to guess, and accents show as they are.
Excel's limits: when only the CSV works
Excel can't hold everything. In these cases, the result screen tells you to take the CSV:
- the result has more than 16,384 columns, Excel's maximum (no Excel file is offered);
- a cell goes over 32,767 characters, the maximum of an Excel cell (no Excel file is offered either);
- the Excel file would go over the size limit of the online reconstruction: the result screen says so and points to the CSV.
- Good to know: a spreadsheet also cuts a CSV that is too wide as soon as it opens (Excel and LibreOffice keep 16,384 columns, Numbers 1,000). To keep every column, pick a narrower row tag in the preview, or process the CSV outside a spreadsheet.
Rebuilding the XML in each case
In every case, the Rebuild page is free.
- With the .xlsx: save it in your spreadsheet, then drop that file, alone, on the Rebuild page.
- With the CSV: save the edited data.csv (preferably as “CSV UTF-8”), then drop it with its skeleton.json in “Separate files”. Don't drop the .excelify.zip archive back as you downloaded it: it would give back the original XML, without your edits.
- With Numbers: Numbers removes the .xlsx's hidden sheet when it saves. Keep the skeleton.json too (link on the result screen, or in the .excelify.zip) and drop it with the Excel file, in “Separate files”.
When CSV is still the best choice
- A script (Python, pandas, a database import) or another tool that reads CSV: CSV is the universal format, with no hidden sheet and no formatting.
- A result too wide or too large for Excel, as seen above.
- The CSV is still offered next to the Excel file: if you open it in a spreadsheet anyway, import it as text (Data › From Text/CSV), otherwise Excel rewrites zeros, codes and dates. The separator is set in “Advanced options” under the preview.
Transform your XML file, then pick the format that suits you:
Transform a file