How to Preserve Excel Date Format When Exporting to XML
Question details
The user needs to export dates to an XML file while maintaining a specific date format (like mm-dd-yyyy) instead of exporting as internal numerical values.

- Product
- Excel / WPS Spreadsheet
- Device & OS
- not provided
- Scenario
- Exporting spreadsheet data that has been mapped to an XML schema.
- Observed behavior
- Dates are exported to XML as internal serial numbers (e.g., 33747) instead of the visually displayed date format.
Before exporting your data, verify the exact date format required by your target XML schema (such as YYYY-MM-DD or MM-DD-YYYY) to ensure proper mapping.
Use a Helper Column with the TEXT Function
The most reliable method to ensure dates export in a specific visual format is converting them to literal text strings using a formula.
Spreadsheet applications store dates internally as serial numbers. Changing the visual format of a cell only changes how it looks on your screen, not the underlying data that gets exported. Using the TEXT function forces the output to become actual text, which maps cleanly to XML.
Right-click the column letter next to your existing date column and select 'Insert' to create a new blank column.
In the first cell of the new column, type =TEXT(A2,"mm-dd-yyyy") replacing A2 with your actual date cell reference and "mm-dd-yyyy" with your required format.
Click the small square at the bottom-right corner of the cell containing the formula and drag it down to fill the rest of your data rows.
Open your XML Source task pane and drag the corresponding XML schema element onto this new helper column instead of the original date column.

Define the Field as a Date Type in the XML Schema
Modify your XML schema file (.xsd) to explicitly define the element as a date data type, allowing the export process to format it automatically.
Manually Enter Dates as Text
Format cells as text before entering data so the system treats the input as literal characters rather than convertible date values.
Export and Manage XML Data with WPS Spreadsheet
WPS Spreadsheet provides powerful data formatting, advanced formula support, and developer tools, making it incredibly easy to prepare and map your data for accurate XML exports.
- 1. Open your data file: Launch WPS Spreadsheet and open the workbook containing the data you wish to export.
- 2. Format dates via formula: Create a helper column using the TEXT function to convert your serial dates into the required XML string format.
- 3. Map to XML schema: Access the developer or data tools to map your customized text column directly to your imported XML schema elements.
- 4. Export seamlessly: Save or export your mapped data as an XML file, ensuring all dates remain perfectly formatted.

Frequently Asked Questions
Why does my exported date show up as a 5-digit number in XML?
Spreadsheet software stores dates internally as serial numbers representing the number of days elapsed since January 1, 1900. When exporting data without a specific text conversion or schema typing, the raw internal number is exported instead of the formatted visual display.
Can I fix the XML export by simply changing the cell format to 'Text'?
No. If you format a cell that already contains a date as Text, it will instantly convert the display to its internal serial number. You must either format a completely empty column as Text before typing the dates, or use the TEXT formula to convert existing dates.
What is the standard date format expected in most XML schemas?
The standard date format for XML generally follows the ISO 8601 specification, which is YYYY-MM-DD (e.g., 2023-10-25). Using the formula =TEXT(A2,"yyyy-mm-dd") ensures maximum compatibility with standard XML systems.




